/* 강릉 디오라마 3D — 지도 한 장(도엽)처럼.
   3D 모형이 지도 본문이고, 화면 장치는 그 둘레의 여백(도곽·표제란·범례·축척·방위표)이다.
   색은 지도처럼 뜻이 있을 때만: 물 이름은 파랑, 산·높이는 갈색, 자료 색은 차트에만. 누르고 고르는 것은 모두 먹 하나.
   도입부(body.intro) → 지도(body.ui-on). 판은 불투명한 종이 (지도 위 흐림 효과 없음). */
:root {
  --table: #dfe3dd;         /* 모형이 놓인 측량 대지 (캔버스 뒤 페이지 바탕) */
  --sheet: #fafaf7;         /* 종이: 위 여백·판·카드 줄·말풍선 */
  --ink: #000;              /* 먹 (인쇄 K100): 글자·괘선·눌림·고름·초점 */
  --ink-hover: #2d3135;
  --graphite: #5b6168;      /* 연필: 보조 글자 (종이 위 6:1, 대지 위 4.8:1) */
  --field: #858c88;         /* 입력 칸·단추 테두리 (종이 위 3.3:1) */
  --rule: #c9cec7;          /* 표 안 괘선 */
  --wash: #eef0eb;          /* 올림·고름 바탕 */
  --water-ink: #24679a;     /* 물 이름 */
  --relief-ink: #8a5530;    /* 산 이름·높이 */
  --fs-s: 12px; --fs-m: 14px; --fs-l: 16px; --fs-xl: 21px;
  --fs-d: clamp(64px, min(10vw, 15vh), 144px);
  --r-mark: 2px; --r-ctl: 6px; --r-sheet: 6px;
  --shadow-sheet: 0 1px 0 #0000001a, 0 8px 18px -12px #00000047;
  --foot-w: 260px;          /* 왼쪽 아래 여백(축척·자료 출처) 너비 — 카드 줄이 그 옆에서 멈춘다 */
  --sans: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --serif: Hahmlet, "Noto Serif KR", AppleMyungjo, "Batang", serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --collar: 56px;
  --dock-h: 120px;          /* 휴대폰 아래 카드 줄 높이 (축척·조작 단추가 그 위에 선다) */
  --ease: cubic-bezier(.2, .7, .1, 1);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font: var(--fs-m)/1.6 var(--sans); color: var(--ink); word-break: keep-all;
  background: radial-gradient(120% 90% at 58% 44%, #e7eae5 0%, var(--table) 55%, #d5dad3 100%);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
kbd { font: 600 var(--fs-s)/1.4 var(--sans); color: var(--graphite); border: 1px solid var(--rule); border-radius: 4px; padding: 0 5px; }
#app { position: fixed; inset: 0; }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none;
  transition: clip-path .6s var(--ease); }
/* 도입부에서는 지도가 도곽 안쪽 괘선에서 잘린다 (지도 한 장처럼). 지도로 들어가면 화면 전체로 */
body.intro #gl { clip-path: inset(31px); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
/* 지도 위에 바로 떠 있는 것은 초점 고리 둘레에 종이색 테를 둘러 어떤 땅 색 위에서도 보이게 */
.label:focus-visible, .place:focus-visible, .ctl:focus-visible, #compass:focus-visible { box-shadow: 0 0 0 5px var(--sheet); }

.sheet { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-sheet); box-shadow: var(--shadow-sheet); }

/* ── 단추 ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: var(--r-ctl); border: 1px solid var(--field); background: var(--sheet); color: var(--ink);
  font: 600 var(--fs-m)/1 var(--sans); cursor: pointer; text-decoration: none; transition: background .15s; }
.btn:hover { background: var(--wash); }
.btn.primary { background: var(--ink); color: var(--sheet); border-color: var(--ink); }
.btn.primary:hover { background: var(--ink-hover); }
.btn.lg { height: 48px; padding: 0 20px; font-size: var(--fs-l); }

/* ── 표제란 표 (도입부·정보 판·통계가 함께 쓴다) ── */
.spec { margin: 0; }
.spec div { display: grid; grid-template-columns: 7.5em 1fr; gap: 12px; align-items: baseline; padding: 8px 0;
  border-bottom: 1px solid var(--rule); }
.spec div:first-child { border-top: 1px solid var(--ink); }
.spec div:last-child { border-bottom-color: var(--ink); }
.spec dt { font-size: var(--fs-s); color: var(--graphite); }
.spec dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.spec dd small { font-size: var(--fs-s); font-weight: 400; color: var(--graphite); margin-left: 6px; }
.relief { color: var(--relief-ink); }

/* ── 도입부: 도곽이 그려지고, 그 안에 도엽 이름과 표제란 ── */
#intro { position: absolute; inset: 0; z-index: 9; display: flex; align-items: center; pointer-events: none;
  background: linear-gradient(90deg, var(--table) 0 30%, #dfe3dde6 44%, #dfe3dd00 62%);
  transition: opacity .8s var(--ease), visibility .8s; }
.neatline { position: absolute; inset: 24px; border: 2px solid var(--ink); pointer-events: none;
  clip-path: inset(0 100% 100% 0); transition: clip-path .7s var(--ease), transform .6s var(--ease), opacity .6s var(--ease); }
.neatline::before { content: ""; position: absolute; inset: 4px; border: 1px solid var(--ink); }
body.drawn .neatline { clip-path: inset(0); }
.intro-inner { position: relative; pointer-events: auto; margin-left: 72px; width: min(440px, 40vw); opacity: 0;
  transition: opacity .4s ease .25s; }
body.drawn .intro-inner { opacity: 1; }
#intro h1 { margin: 0 -.32em 0 0; font: 700 var(--fs-d)/1 var(--sans); letter-spacing: .32em; }
#intro .sub { margin: 16px 0 0; font-size: var(--fs-xl); line-height: 1.3; }
#intro .lead { margin: 14px 0 0; font-size: var(--fs-l); line-height: 1.75; color: var(--graphite); }
#intro .spec { margin-top: 22px; }
.kfoot { margin: 10px 0 0; font-size: var(--fs-s); color: var(--graphite); }
.kfoot .f-mob { display: none; }
.cta { display: flex; gap: 10px; margin-top: 24px; flex-wrap: wrap; }
.hint { margin: 12px 0 0; font-size: var(--fs-s); color: var(--graphite); }
body:not(.intro) #intro { opacity: 0; visibility: hidden; }
body:not(.intro) .neatline { transform: scale(1.06); opacity: 0; }
@media (min-width: 761px) and (max-height: 820px) {
  #intro .r-range { display: none; }
  #intro .sub { margin-top: 10px; } #intro .lead { margin-top: 8px; } #intro .spec { margin-top: 14px; } .cta { margin-top: 16px; }
}

/* 도입부 동안 지도 장치는 숨기고, 지도로 들어가면 나타난다 (옮기지 않고 서서히) */
#topbar, .dock, .navctl, .collar-foot, #labels { transition: opacity .4s var(--ease), visibility .4s; }
body.intro #topbar, body.intro .dock, body.intro .navctl, body.intro .collar-foot { opacity: 0; visibility: hidden; pointer-events: none; }
body.intro #labels { opacity: 0; }
body.ui-on .dock, body.ui-on .navctl, body.ui-on .collar-foot { transition-delay: .3s; }

/* ── 위 여백: 화면 너비 전체, 아래에 도곽의 이중 괘선 ── */
#topbar { position: absolute; left: 0; right: 0; top: 0; z-index: 20; height: calc(var(--collar) + var(--safe-t));
  padding: var(--safe-t) 16px 0; display: flex; align-items: center; gap: 20px; background: var(--sheet);
  box-shadow: 0 1px 0 var(--ink), 0 4px 0 var(--sheet), 0 5px 0 var(--ink), 0 14px 18px -14px #00000040; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; white-space: nowrap; }
.logo svg { width: 28px; height: 28px; }
.seg { display: flex; align-self: stretch; }
.seg button { border: 0; background: none; padding: 0 12px; font-weight: 600; color: var(--graphite); cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button[aria-selected="true"] { color: var(--ink); box-shadow: inset 0 -3px 0 var(--ink); }
.crumb { display: flex; align-items: center; gap: 6px; color: var(--graphite); white-space: nowrap; min-width: 0; }
.crumb button { border: 0; background: none; padding: 4px 6px; border-radius: 4px; cursor: pointer; color: var(--graphite); font-weight: 600; }
.crumb button:hover { background: var(--wash); color: var(--ink); }
.crumb b { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.search { position: relative; margin-left: auto; display: flex; align-items: center; gap: 8px; width: 300px; height: 36px;
  padding: 0 10px; border: 1px solid var(--field); border-radius: var(--r-ctl); background: #fff; }
.search:focus-within { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.search svg { width: 17px; height: 17px; fill: none; stroke: var(--graphite); stroke-width: 2; stroke-linecap: round; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font: var(--fs-m) var(--sans); color: var(--ink); }
.search input::placeholder { color: var(--graphite); }
.search input::-webkit-search-cancel-button { display: none; }
#results { position: absolute; left: -1px; right: -1px; top: 42px; margin: 0; padding: 4px; list-style: none; max-height: 360px; overflow: auto;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; box-shadow: var(--shadow-sheet); }
#results li { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 10px; border-radius: 4px; cursor: pointer; }
#results li[aria-selected="true"], #results li:hover { background: var(--wash); box-shadow: inset 2px 0 0 var(--ink); }
#results .ic { width: 24px; height: 24px; display: grid; place-items: center; flex: none; color: var(--graphite); }
#results .ic svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
#results .ic.blk { background: var(--ink); color: var(--sheet); border-radius: var(--r-mark); }
#results .ic.i-peak { color: var(--relief-ink); } #results .ic.i-lake { color: var(--water-ink); }
#results b { font-weight: 600; }
#results small { margin-left: auto; font-size: var(--fs-s); color: var(--graphite); white-space: nowrap; }
#results .empty { color: var(--graphite); cursor: default; }
#results .head { min-height: 0; padding: 6px 10px 2px; font-size: var(--fs-s); color: var(--graphite); cursor: default; }
#results .head:hover { background: none; box-shadow: none; }
#results .empty:hover { background: none; box-shadow: none; }
.fab { position: relative; display: flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px 0 10px; flex: none;
  border: 1px solid var(--field); border-radius: var(--r-ctl); background: var(--sheet); font-weight: 600; cursor: pointer; }
.fab:hover { background: var(--wash); }
.fab svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.fab[aria-expanded="true"] { background: var(--ink); color: var(--sheet); border-color: var(--ink); }
.fab.has-on::after { content: ""; position: absolute; right: -4px; top: -4px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--ink); box-shadow: 0 0 0 2px var(--sheet); }
#topbar .only-m { display: none; }
.sclose { display: none; place-items: center; flex: none; width: 32px; height: 32px; border: 1px solid var(--field);
  border-radius: var(--r-ctl); background: var(--sheet); cursor: pointer; font-size: 12px; }

/* ── 종이 판 (블록 정보·통계·지도에 표시) ── */
.panel, .info, .dash { position: absolute; top: calc(var(--collar) + var(--safe-t) + 16px); z-index: 10; overflow: auto;
  max-height: calc(100% - var(--collar) - var(--safe-t) - 32px); scrollbar-width: thin; animation: open .16s ease-out; }
@keyframes open { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.panel { right: 16px; width: 320px; padding: 0 16px 8px; z-index: 12; max-height: calc(100% - 200px); }
.info { right: 16px; width: 380px; }
.dash { left: 16px; width: 400px; padding: 0 20px 20px; }
.panel-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0 10px; margin-bottom: 4px; background: var(--sheet); border-bottom: 1px solid var(--rule); }
.panel h2, .dash h2 { margin: 0; font-size: var(--fs-l); font-weight: 600; }
.x { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border: 1px solid var(--field); border-radius: var(--r-ctl);
  background: var(--sheet); cursor: pointer; font-size: 13px; color: var(--ink); }
.x:hover { background: var(--wash); }

/* 지도에 표시할 것 */
.lrow { padding: 12px 0; border-top: 1px solid var(--rule); }
.lrow:first-child { border-top: 0; }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .sw { position: relative; flex: none; width: 32px; height: 18px; border-radius: 999px; background: var(--field); transition: background .2s; }
.switch .sw::after { content: ""; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--sheet); transition: transform .2s var(--ease); }
.switch input:checked + .sw { background: var(--ink); }
.switch input:checked + .sw::after { transform: translateX(14px); }
.switch input:focus-visible + .sw { outline: 2px solid var(--ink); outline-offset: 2px; }
.lnote { margin: 5px 0 0 42px; font-size: var(--fs-s); color: var(--graphite); line-height: 1.5; }
.keys { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 6px 0 0 42px; font-size: var(--fs-s); color: var(--graphite); }
.keys i { display: inline-block; width: 16px; height: 3px; margin-right: 5px; vertical-align: middle; }
.golink { display: inline-block; margin: 6px 0 0 42px; padding: 4px 0; border: 0; background: none; cursor: pointer;
  font-weight: 600; color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.golink:hover { text-decoration-thickness: 2px; }

/* 블록 정보 */
.info:focus { outline: none; }
.info-bar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 10px; height: 52px; margin-bottom: -52px;
  padding: 0 10px 0 20px; border-bottom: 1px solid transparent; transition: background .15s, border-color .15s; }
.info-bar b { margin-right: auto; font-weight: 700; opacity: 0; transition: opacity .15s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info.scrolled .info-bar { background: var(--sheet); border-bottom-color: var(--rule); }
.info-bar .x svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chip { flex: none; height: 32px; padding: 0 10px; border: 1px solid var(--ink); border-radius: var(--r-ctl); background: var(--ink); color: var(--sheet);
  font-size: var(--fs-s); font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip::after { content: " ✕"; }
.linkbox { flex: 1; min-width: min(280px, 60vw); height: 32px; padding: 0 8px; border: 1px solid var(--field); border-radius: 4px; font: var(--fs-s) var(--sans); }
.info.scrolled .info-bar b { opacity: 1; }
.hero { margin: 0; aspect-ratio: 16 / 10; overflow: hidden; background: #e9ece7; border-bottom: 1px solid var(--rule);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0; }
.hero img { display: block; width: 100%; height: 100%; object-fit: cover; }
.info-body { padding: 14px 20px 20px; user-select: text; }
.tag { margin: 0 0 2px; font-size: var(--fs-s); font-weight: 600; color: var(--graphite); }
.info h2 { margin: 0; font-size: var(--fs-xl); line-height: 1.3; font-weight: 700; }
.desc { margin: 8px 0 16px; color: var(--graphite); line-height: 1.7; }
.zl h3 { margin: 20px 0 0; font-size: var(--fs-m); font-weight: 700; }
.zl h3 small { display: block; font-size: var(--fs-s); font-weight: 400; color: var(--graphite); }
.zl-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; }
.zl-reset { border: 0; background: none; padding: 4px 0; cursor: pointer; font-size: var(--fs-s); font-weight: 600; color: var(--ink);
  text-decoration: underline; text-underline-offset: 3px; }
.mini { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: var(--fs-s); color: var(--graphite); cursor: pointer; }
.mini input { accent-color: var(--ink); margin: 0; }
.zl ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.zl li button { width: 100%; min-height: 36px; display: flex; align-items: center; gap: 10px; padding: 6px; border: 0;
  border-bottom: 1px solid var(--rule); background: none; text-align: left; cursor: pointer; line-height: 1.35; }
.zl li button:hover { background: var(--wash); }
.zl li button[aria-pressed="true"] { background: var(--wash); font-weight: 600; box-shadow: inset 3px 0 0 var(--ink); }
/* 한 구역만 볼 때 나머지 행은 흐리게 (무엇이 숨었는지 보이게) */
.zl ul.filtering li button:not([aria-pressed="true"]), .zl ul.filtering li.other { opacity: .45; }
.zl ul.filtering li button:hover { opacity: 1; }
.zl i { flex: none; width: 14px; height: 10px; border-radius: 1px; box-shadow: inset 0 0 0 1px #00000033; }
.zl .cx { color: var(--graphite); }
.zl em { margin-left: auto; font-style: normal; font-size: var(--fs-s); color: var(--graphite); font-variant-numeric: tabular-nums; white-space: nowrap; }
.zl li.other { display: flex; align-items: center; justify-content: space-between; min-height: 36px; padding: 6px;
  border-bottom: 1px solid var(--rule); color: var(--graphite); }
.zl li.other span { display: flex; align-items: center; gap: 10px; }
.zl li.total { display: flex; justify-content: space-between; margin-top: -1px; padding: 8px 6px 0; border-top: 1px solid var(--ink); font-weight: 700; }
.zl li.total em { color: var(--ink); font-size: var(--fs-m); }
.zl-note { margin: 8px 0 0; font-size: var(--fs-s); color: var(--graphite); line-height: 1.6; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

/* ── 통계 ── */
.lede { margin: 14px 0 14px; line-height: 1.7; }
.sec { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--rule); }
.sec h3 { margin: 0 0 2px; font-size: var(--fs-l); font-weight: 600; }
.sec .meta { margin: 0 0 10px; font-size: var(--fs-s); color: var(--graphite); line-height: 1.55; }
.xsec svg { display: block; width: 100%; height: auto; overflow: visible; }
.xsec text { font: 400 12px var(--sans); fill: var(--graphite); }
.xsec text.k { font-weight: 600; fill: var(--ink); }
.xsec text.w { font-family: var(--serif); font-weight: 600; fill: var(--water-ink); letter-spacing: .4em; }
.xsec text.r { fill: var(--relief-ink); font-weight: 600; }
.stack { display: flex; gap: 1px; height: 12px; margin: 8px 0 10px; background: var(--sheet); }
.stack span { display: block; height: 100%; min-width: 2px; cursor: default; }
.lc { width: 100%; border-collapse: collapse; margin-bottom: 4px; }
.lc td { height: 32px; padding: 4px 0; border-bottom: 1px solid var(--rule); }
.lc td:nth-child(2), .lc td:nth-child(3) { text-align: right; font-variant-numeric: tabular-nums; color: var(--graphite); }
.lc td:nth-child(2) { width: 60px; font-weight: 600; color: var(--ink); }
.lc td:nth-child(3) { width: 88px; }
.lc i { display: inline-block; width: 14px; height: 10px; margin-right: 8px; border-radius: 1px; vertical-align: -1px; }
.hist-x { display: flex; justify-content: space-between; margin-top: 10px; padding: 0 4px 4px; font-size: var(--fs-s); color: var(--graphite);
  border-bottom: 1px solid var(--ink); }
.hist { display: grid; gap: 1px; margin: 4px 0 6px; }
.hist .col { display: grid; grid-template-columns: 9.2em 1fr 3.6em; align-items: center; gap: 10px; height: 24px; padding: 0 4px;
  border-radius: var(--r-mark); cursor: default; }
.hist .col:hover, .hist .col:focus-visible { background: var(--wash); }
.hist .col em { font-style: normal; font-size: var(--fs-s); color: var(--relief-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hist .col span { display: block; height: 10px; min-width: 2px; }
.hist .col b { font-size: var(--fs-s); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cmp { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.cmp th { padding: 0 0 6px; font-size: var(--fs-s); font-weight: 400; color: var(--graphite); text-align: right; border-bottom: 1px solid var(--ink); white-space: nowrap; }
.cmp th:first-child, .cmp td:first-child { text-align: left; }
.cmp td { padding: 6px 0; border-bottom: 1px solid var(--rule); text-align: right; vertical-align: top; }
.cmp td + td, .cmp th + th { padding-left: 10px; }
.cmp .golink { margin: 0; padding: 0; text-align: left; }
.cmp small { display: block; font-size: var(--fs-s); color: var(--graphite); line-height: 1.45; }
.blkgrid { display: grid; grid-template-columns: repeat(3, 1fr); margin: 8px 0 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.blkgrid div { padding: 8px 10px; border-left: 1px solid var(--rule); }
.blkgrid div:first-child { border-left: 0; padding-left: 0; }
.blkgrid dt { font-size: var(--fs-s); color: var(--graphite); }
.blkgrid dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.foot { margin: 16px 0 0; font-size: var(--fs-s); color: var(--graphite); line-height: 1.6; }

/* ── 건물까지 깎은 곳 (아래 가운데, 괘선으로 나눈 한 장) ── */
.dock { position: absolute; left: 50%; bottom: calc(16px + var(--safe-b)); transform: translateX(-50%); z-index: 4;
  max-width: calc(100% - 2 * (var(--foot-w) + 32px)); padding: 10px 12px 10px; }
.dock-title { margin: 0 0 6px 2px; font-size: var(--fs-s); font-weight: 600; }
.cards { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.cards.more { mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); }
.cards::-webkit-scrollbar { display: none; }
/* 카드는 줄 너비에 맞춰 140→112 px 까지 줄고, 그래도 모자라면 옆으로 민다 */
.card { flex: 0 1 140px; min-width: 112px; display: block; padding: 6px 10px 2px; border: 0; border-left: 1px solid var(--rule);
  border-top: 3px solid transparent; background: none; text-align: left; cursor: pointer; scroll-snap-align: start; }
.card:first-child { border-left: 0; }
.card:focus-visible { outline-offset: -3px; }
.card:hover { background: var(--wash); }
.card[aria-pressed="true"] { border-top-color: var(--ink); background: var(--wash); }
.card .img { display: block; height: 72px; overflow: hidden; border-radius: var(--r-mark); background: #e9ece7; outline: 1px solid var(--rule); outline-offset: -1px; }
.card img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card .t { display: block; padding: 6px 0 2px; }
.card .tag { display: block; margin: 0; }
.card b { display: block; margin-top: 1px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card[aria-pressed="true"] b { font-weight: 700; }

/* ── 방위표·확대·처음으로 ── */
.navctl { position: absolute; right: 16px; bottom: calc(16px + var(--safe-b)); z-index: 4; display: flex; flex-direction: column; gap: 8px; }
.ctl { display: grid; place-items: center; width: 44px; height: 44px; border: 0; background: var(--sheet); cursor: pointer;
  font: 400 22px/1 var(--sans); color: var(--ink); }
.ctl:hover { background: var(--wash); }
#compass { border: 1px solid var(--field); border-radius: var(--r-ctl); }
#compass svg { width: 34px; height: 34px; }
#needle { transform-origin: 20px 20px; }
#needle path { fill: var(--ink); }
#needle path.half { fill: var(--sheet); stroke: var(--ink); stroke-width: 1; stroke-linejoin: round; }
#needle text { font: 700 10px var(--sans); fill: var(--ink); }
.zoom { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--field); border-radius: var(--r-ctl); background: var(--sheet); }
.zoom .ctl + .ctl { border-top: 1px solid var(--rule); }
.ctl svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
body.info-open .navctl { right: 412px; }

/* ── 아래 여백: 커서 경위도·해발, 축척, 자료 출처 ── */
.collar-foot { position: absolute; left: 16px; bottom: calc(16px + var(--safe-b)); z-index: 15; max-width: var(--foot-w);
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; font-size: var(--fs-s); }
.coord, .scale, #cred-btn { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-mark); }
.coord { margin: 0; padding: 3px 8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.coord:empty { display: none; }
.foot-row { display: flex; gap: 6px; align-items: stretch; }
.scale { display: flex; align-items: center; gap: 6px; padding: 3px 8px; pointer-events: none; }
.scale span:first-child { color: var(--graphite); }
#scale-bar { display: block; height: 6px; width: 80px; border: 1px solid var(--ink);
  background: linear-gradient(90deg, var(--ink) 50%, var(--sheet) 50%) 0 0 / 50% 100%; transition: width .2s; }
#scale-text { font-weight: 600; white-space: nowrap; }
#cred-btn { padding: 3px 8px; font-size: var(--fs-s); font-weight: 600; color: var(--graphite); cursor: pointer; white-space: nowrap; }
#cred-btn:hover, #cred-btn[aria-expanded="true"] { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
#credits { position: absolute; left: 0; bottom: calc(100% + 6px); width: min(var(--foot-w), calc(100vw - 32px)); margin: 0; padding: 8px 12px;
  list-style: none; background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; box-shadow: var(--shadow-sheet); line-height: 1.6; }
#credits li + li { border-top: 1px solid var(--wash); }
/* 통계가 열리면 왼쪽 아래 여백은 통계 판 오른쪽으로 비킨다 */
body.dash-open .collar-foot { left: 432px; }
/* 판이 열리면 카드 줄은 남은 틈(왼쪽 여백·통계 판 오른쪽 ~ 정보 판·조작 단추 왼쪽)에 들어가고, 넘치면 옆으로 민다 */
body.dash-open .dock { left: calc(432px + var(--foot-w) + 16px); transform: none; max-width: calc(100% - 432px - var(--foot-w) - 16px - 76px); }
body.info-open .dock { left: calc(var(--foot-w) + 32px); transform: none; max-width: calc(100% - var(--foot-w) - 32px - 472px); }
/* 두 판이 다 열리면 카드 줄은 쉰다 (남는 틈이 카드 두어 장뿐) */
body.info-open.dash-open .dock { opacity: 0; visibility: hidden; pointer-events: none; }

/* ── 지도 글자: 모양이 종류를 말한다 ── */
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.places { position: absolute; inset: 0; }
.place { position: absolute; left: 0; top: 0; display: flex; align-items: baseline; gap: 3px; padding: 0 2px; border: 0; background: none;
  font: 600 var(--fs-s)/1.3 var(--sans); color: var(--ink); white-space: nowrap; cursor: pointer; pointer-events: none;
  opacity: 0; visibility: hidden; transition: opacity .3s;
  text-shadow: 1px 0 #fff, -1px 0 #fff, 0 1px #fff, 0 -1px #fff, 1px 1px #fff, -1px -1px #fff, 1px -1px #fff, -1px 1px #fff, 0 0 5px #fff; }
.place.on { opacity: 1; visibility: visible; pointer-events: auto; }
.place:hover span { text-decoration: underline; text-underline-offset: 2px; }
.place.k-city { font-size: var(--fs-m); font-weight: 700; letter-spacing: .5em; }
.place.k-town { font-size: var(--fs-m); }
.place.k-village, .place.k-poi { font-weight: 400; color: #3d4248; }
.place.k-station::before { content: ""; align-self: center; width: 10px; height: 5px; margin-right: 2px; border: 1.5px solid var(--ink); background: var(--sheet); }
.place.k-peak { color: var(--relief-ink); }
.place.k-peak span { font: 600 13px var(--serif); }
.place.k-peak i { font-style: normal; font-size: 9px; }
.place small { font-size: var(--fs-s); font-weight: 600; font-variant-numeric: tabular-nums; }
.place.k-quarter { font-weight: 600; color: #3d4248; }
.place.k-pass { color: var(--relief-ink); }
.place.k-pass span { font: 600 13px var(--serif); }
/* 찾은 곳: 다음에 찾거나 처음으로 갈 때까지 먹 상자로 남는다 */
.place.found.on { z-index: 2; }
.place.found span { padding: 2px 6px; background: var(--ink); color: var(--sheet); text-shadow: none; border-radius: var(--r-mark);
  box-shadow: 0 0 0 1.5px #fafaf7cc; }
.place.k-lake { color: var(--water-ink); }
.place.k-lake span { font: 600 var(--fs-m) var(--serif); }
.place.k-sea { color: var(--water-ink); }
.place.k-sea span { font: 600 var(--fs-l) var(--serif); letter-spacing: 1em; margin-right: -1em; }
.place.k-range { color: var(--relief-ink); }
.place.k-range span { font: 600 var(--fs-m) var(--serif); letter-spacing: .6em; margin-right: -.6em; }

/* 블록 핀: 먹 깃발 + 열쇠 네모 + 곧은 대 (글자만 있는 지명과 모양으로 구별) */
.label { position: absolute; left: 0; top: 0; z-index: 1; display: flex; align-items: center; gap: 6px; min-height: 26px; padding: 3px 9px 3px 7px;
  border: 1px solid var(--ink); border-radius: var(--r-mark); background: var(--ink); color: var(--sheet);
  font: 600 var(--fs-s)/1.3 var(--sans); white-space: nowrap; cursor: pointer; pointer-events: auto; box-shadow: 0 0 0 1.5px #fafaf7cc; }
.label::after { content: ""; position: absolute; left: 50%; top: 100%; width: 1.5px; height: 7px; background: var(--ink); transform: translateX(-50%); }
.label .dot { width: 7px; height: 7px; background: var(--sheet); }
.label .lead { position: absolute; left: 50%; top: 100%; width: 1px; height: 0; background: var(--ink); transform: translateX(-50%); pointer-events: none; }
.label:hover, .label.hover { background: var(--sheet); color: var(--ink); }
.label:hover .dot, .label.hover .dot { background: var(--ink); }
.label.lifted::after { display: none; }
.label.dim { opacity: .25; }

/* ── 말풍선·알림 ── */
#tip { position: absolute; display: none; pointer-events: none; z-index: 40; max-width: 280px; padding: 6px 10px;
  background: var(--sheet); color: var(--ink); border: 1px solid var(--ink); border-radius: 4px;
  font-size: var(--fs-s); line-height: 1.5; box-shadow: 0 6px 16px -8px #00000059; }
#tip b { font-weight: 600; }
#tip .ltag { color: var(--graphite); }
#toast { position: absolute; left: 50%; top: calc(var(--collar) + var(--safe-t) + 16px); transform: translateX(-50%); z-index: 25;
  display: flex; align-items: center; gap: 10px; width: max-content; max-width: min(92vw, 440px); padding: 8px 8px 8px 14px;
  background: var(--sheet); color: var(--ink); border: 1px solid var(--ink); border-radius: var(--r-ctl); box-shadow: var(--shadow-sheet);
  overflow-wrap: anywhere; animation: toastin .3s var(--ease); }
/* 가운데 맞춤(translateX)을 지키며 나타난다 */
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }
#toast button { flex: none; height: 32px; padding: 0 12px; border: 0; border-radius: 4px; background: var(--ink); color: var(--sheet);
  font-weight: 600; cursor: pointer; white-space: nowrap; }
#toast button.ghost { background: none; color: var(--ink); border: 1px solid var(--field); }

/* ── 불러오는 화면: 진행 막대는 축척 막대처럼 흑백 마디로 자란다 ── */
#splash { position: absolute; inset: 0; z-index: 50; display: grid; place-items: center; background: var(--table);
  transition: opacity .8s var(--ease), visibility .8s; }
#splash.done { opacity: 0; visibility: hidden; }
.sp { width: 240px; text-align: center; }
.sp-logo { width: 32px; height: 32px; }
.sp-name { margin: 10px 0 18px; font-size: var(--fs-l); font-weight: 600; }
.bar { width: 200px; height: 6px; margin: 0 auto; border: 1px solid var(--ink); }
.bar i { display: block; height: 100%; width: 4%; transition: width .3s ease;
  background: linear-gradient(90deg, var(--ink) 50%, var(--sheet) 50%) 0 0 / 20px 100%; }
#sp-text { margin: 10px 0 0; font-size: var(--fs-s); color: var(--graphite); }
#retry { margin-top: 14px; }

/* ── 좁은 화면 ── */
@media (max-width: 1100px) {
  .search { width: 240px; }
  .dock { max-width: calc(100% - 400px); }
  /* 정보 판·통계와 카드 줄을 나란히 둘 너비가 안 되면 카드 줄은 잠시 비킨다 (카드는 판의 '강릉 전체로 돌아가기'로 다시 나온다) */
  body.info-open .dock, body.dash-open .dock { opacity: 0; visibility: hidden; pointer-events: none; }
  /* 좁은 데스크톱: 카드 줄은 왼쪽 아래 여백 오른쪽에서 시작한다 (가운데에 두면 축척·자료 출처와 겹친다) */
  .dock { left: calc(var(--foot-w) + 32px); right: 76px; transform: none; max-width: none; }
  body.dash-open .collar-foot { opacity: 0; visibility: hidden; pointer-events: none; }
}
@media (max-width: 760px) {
  :root { --collar: 52px; }
  /* 도입부: 모형은 위쪽 절반, 도엽 이름과 표제란은 아래 */
  #intro { align-items: flex-end; background: linear-gradient(0deg, var(--table) 0 42%, #dfe3dde6 60%, #dfe3dd00 80%); }
  .neatline { inset: calc(8px + var(--safe-t)) 8px calc(8px + var(--safe-b)); }
  .intro-inner { width: auto; margin: 0; padding: 0 24px calc(28px + var(--safe-b)); }
  #intro h1 { font-size: clamp(52px, 17vw, 72px); }
  #intro .sub { margin-top: 10px; font-size: var(--fs-l); font-weight: 600; }
  #intro .lead { margin-top: 8px; font-size: var(--fs-m); }
  #intro .spec { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; margin-top: 14px;
    border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
  #intro .spec div { display: block; padding: 6px 0; border: 0; }
  #intro .spec div:nth-child(n+4) { border-top: 1px solid var(--rule); }
  #intro .spec .r-range, #intro .spec .r-vex { display: none; }
  #intro .spec dd small { display: none; }
  .kfoot .f-desk { display: none; } .kfoot .f-mob { display: inline; }
  .cta { margin-top: 14px; flex-wrap: nowrap; } .cta .btn { flex: 1; padding: 0 12px; }
  .hint { display: none; }

  #topbar { gap: 4px; padding: var(--safe-t) 8px 0; }
  .logo { width: 44px; height: 44px; justify-content: center; }
  .logo span { display: none; }
  .seg button { padding: 0 12px; }
  #crumb { display: none !important; }
  .search { display: none; } .search kbd { display: none; }
  #topbar .only-m { display: flex; margin-left: auto; }
  .fab { width: 44px; height: 44px; padding: 0; justify-content: center; } .fab span { display: none; }
  body.searching .logo, body.searching .seg, body.searching #search-open, body.searching #btn-layers { display: none; }
  body.searching .search { display: flex; flex: 1; height: 44px; margin-left: 0; }
  body.searching .sclose { display: grid; }
  body.searching #topbar .only-m { display: none; }
  .x, .sclose { width: 44px; height: 44px; }

  /* 판은 아래에서 올라오는 종이 */
  .panel, .info { left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: 74%; z-index: 7;
    border-radius: 12px 12px 0 0; border-width: 1px 0 0; border-color: var(--ink); padding-bottom: calc(16px + var(--safe-b)); }
  .info { max-height: 46%; padding-bottom: var(--safe-b); }
  .info .hero { display: none; }
  .info-bar { padding-left: 20px; }
  .info-body { padding-top: 12px; }
  .info h2 { padding-right: 52px; }
  .dash { inset: 0; width: auto; max-height: none; height: 100%; z-index: 30; border: 0; border-radius: 0;
    padding: 0 20px calc(24px + var(--safe-b)); }
  .dash .panel-head { padding-top: calc(12px + var(--safe-t)); }
  body.dash-open #labels, body.dash-open .dock, body.dash-open .navctl, body.dash-open .collar-foot { opacity: 0; visibility: hidden; pointer-events: none; }
  body.dash-open .collar-foot { left: 12px; }
  body.info-open .dock { opacity: 0; visibility: hidden; transform: translateY(24px); pointer-events: none; }
  body.info-open .navctl, body.info-open .collar-foot, body.layers-open .navctl, body.layers-open .collar-foot { opacity: 0; visibility: hidden; pointer-events: none; }
  body.intro #gl { clip-path: inset(calc(15px + var(--safe-t)) 15px calc(15px + var(--safe-b))); }

  /* 카드 줄은 아래에 붙은 한 장, 옆으로 밀어 보고 오른쪽 끝을 흐려 더 있음을 보인다 */
  .dock { left: 0; right: 0; bottom: 0; transform: none; max-width: none; padding: 8px 8px calc(8px + var(--safe-b));
    border-radius: 12px 12px 0 0; border-width: 1px 0 0; border-color: var(--ink); }
  body.intro .dock { transform: translateY(16px); }
  .dock-title { display: none; }
  .cards { mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
  .card { width: 124px; padding: 6px 8px 2px; }
  .card .img { height: 56px; }

  .navctl { right: 12px; bottom: calc(var(--dock-h) + 12px + var(--safe-b)); }

  .collar-foot { left: 12px; bottom: calc(var(--dock-h) + 12px + var(--safe-b)); width: auto; }
  .coord { display: none; }
  #cred-btn { min-height: 32px; }
  #credits { width: min(300px, calc(100vw - 90px)); }
  #toast { top: calc(var(--collar) + var(--safe-t) + 12px); }
}
@media (min-width: 761px) and (max-height: 640px) {
  .neatline { inset: 12px; }
  body.intro #gl { clip-path: inset(19px); }
  .intro-inner { margin-left: 48px; }
  #intro h1 { font-size: clamp(44px, 11vh, 96px); }
  #intro .lead .l2, .kfoot, .hint, #intro .r-vex { display: none; }
  #intro .sub { font-size: var(--fs-l); margin-top: 6px; } #intro .lead { font-size: var(--fs-m); margin-top: 6px; }
  #intro .spec { margin-top: 10px; } #intro .spec div { padding: 5px 0; } .cta { margin-top: 12px; }
  /* 카드 줄은 사진 없이 이름만 (지도를 덜 가리게) */
  .card .img, .dock-title { display: none; }
  .card { padding-top: 4px; }
}
@media (max-width: 760px) and (max-height: 700px) {
  #intro .lead .l2, .kfoot { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .neatline { clip-path: none; }
}
