/* 복음의 길 — 사도행전 지도
   레이아웃: 휴대폰은 지도(위)·이야기 카드(아래) 한 줄, 넓은 화면은 왼쪽 카드 패널 + 오른쪽 지도.
   색과 글씨는 새암교회 전세대 테마(homepage/tokens/theme-allgen.css)를 따른다. 밝은 화면 하나로 고정. */
:root {
  color-scheme: light;
  /* 전세대 테마에서 가져온 값 */
  --bg: #F8F6F2;            /* 웜 본 */
  --surface: #FFFFFF;
  --tint: #F0FAF6;
  --ink: #171719;
  --ink-2: #2E2F33;
  --ink-3: #5A5C63;
  --line: #D8D2C6;
  --line-soft: #ECE7DE;
  --line-strong: #8F8879;
  --primary: #1A6B5A;
  --primary-strong: #15594B;
  --primary-heavy: #10453A;
  --brass-text: #8A6A1F;
  --gold: #C99A3C;
  --focus: #1A6B5A;
  /* 지도 */
  --sea: #CFE1E4;
  --land: #F4EFE6;
  --coast: #A9A08F;
  --shadow: 0 1px 2px rgba(20,38,74,.05), 0 10px 30px -12px rgba(20,38,74,.14);
  --shadow-raised: 0 2px 6px rgba(20,38,74,.08), 0 18px 48px -16px rgba(20,38,74,.22);
  /* 글씨 */
  /* 글꼴: Pretendard(SIL OFL 1.1, vendor/pretendard에 함께 둠). 제목도 같은 글꼴을 굵게 써서 한 가족으로 보이게 한다 */
  --font-ui: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  --font-display: var(--font-ui);
  /* 그때와 지금: 성경 시대 이름은 갈색, 오늘날 이름은 회청색. 지도·카드·인쇄물 모두 같은 색 */
  --old: #7A5718;           /* 성경 시대 지방(텍스트, 흰 바탕 6.3:1) */
  --old-map: #7A5718;       /* 지도 위 지방 이름(육지 바탕 5.7:1) */
  --now: #3F5D6E;           /* 오늘날 이름(텍스트, 흰 바탕 7.0:1) */
  --now-map: #4A6676;       /* 지도 위 나라 이름(육지 바탕 5.3:1) */
  --sea-label: #46666D;     /* 바다 이름(바다 바탕 4.6:1) */
  --dim-ink: #5F6167;       /* 다른 이야기의 장소 이름(육지 바탕 5.4:1) */
  --future: #7F796C;        /* 앞으로 갈 길(가는 회색 실선) */
  /* 누름 상태: 샘물 DS처럼 크기는 그대로 두고 옅은 잉크를 덧씌운다 */
  --hover: rgba(23, 23, 25, .06);
  --press: rgba(23, 23, 25, .14);
  --dim: rgba(0, 0, 0, .52);  /* 대화상자 뒤 어둡게(샘물 DS Dimmer) */
  --t-title: 1.5rem;
  --t-heading: 1.375rem;
  --t-body: 1.125rem;
  --t-label: 1rem;
  --t-caption: .9375rem;
  --tap: 48px;
  --radius: 16px;
  --radius-btn: 11px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--t-body);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
/* 아이콘: 글자(▶ ✕)를 아이콘으로 쓰지 않는다(기기마다 이모지로 바뀔 수 있음). 샘물 DS처럼 SVG + currentColor */
.ic { width: 1.15em; height: 1.15em; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ic.fill { fill: currentColor; stroke: none; }
.sr { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* 나란히 배치(PC·iPad 가로)는 화면 한 장짜리 앱: 문서 전체가 스크롤되지 않게(왼쪽 패널만 스크롤). 확대·축소나 다른 탭에 다녀와도 위아래가 밀리지 않는다 */
@media (min-width: 960px), (orientation: landscape) and (max-height: 500px) { html, body { height: 100%; overflow: hidden; } }
/* 화면낭독기용 숨은 글(.sr)은 position:absolute라, 기준이 없으면 문서 맨 위를 기준으로 카드 칸 밖까지 문서 높이를 늘린다(휴대폰에서 화면이 밀리는 원인).
   카드 칸과 body를 기준으로 삼아 그 안에서 잘리게 한다 */
body, .panel { position: relative; }

/* ── 뼈대 ───────────────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "head" "map" "panel";
  min-height: 100%;
}
.masthead { grid-area: head; }
.map-wrap { grid-area: map; }
/* 지도 위(이름표·번호·범례·단추 포함)에서는 브라우저가 화면 전체를 확대하지 않게: 두 손가락·트랙패드 확대는 지도만 (pinchOnlyMap) */
.map-wrap { touch-action: none; }
.panel { grid-area: panel; }

@media (min-width: 960px) {
  .app {
    height: 100%;
    grid-template-columns: 440px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "head map" "panel map";
  }
  .panel { overflow-y: auto; }
}

/* ── 머리 ──────────────────────────────────────────────────────────── */
.masthead {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-block: 14px 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: var(--bg);
}
/* 머리 한 줄: [☰ 묶음 · 번호 / 이야기 이름 ▾] ······ [찾기] */
.masthead { padding-block: 10px; border-bottom: 1px solid var(--line-soft); }
/* 이름과 슬로건(2026-11-06 사용자 요청): 머리 맨 위 한 줄, 그 아래 [☰ 이야기] [찾기] */
.masthead { flex-wrap: wrap; row-gap: 8px; }
.brand-line { flex: 1 0 100%; display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-line .logo { width: 36px; height: 36px; flex-shrink: 0; display: block; }   /* 로고 L 「성경 위로 난 길」(brand/logo) */
.brand-w { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.brand-t { margin: 0; font-size: 1.25rem; font-weight: 800; line-height: 1.2; letter-spacing: -.01em; color: var(--primary-heavy); }
.brand-s { margin: 0; font-size: .8125rem; line-height: 1.3; color: var(--ink-3); }
.menu-btn {
  flex: 1 1 auto; min-width: 0; max-width: 520px; display: flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 4px 12px 4px 10px; border: 1px solid var(--line-strong); border-radius: 14px;
  background: var(--surface); background-clip: padding-box; cursor: pointer; text-align: left; position: relative;
  box-shadow: inset 4px 0 0 var(--chip, var(--primary));   /* 지금 이야기 색 */
}
.menu-btn > .ic { width: 22px; height: 22px; color: var(--ink-2); }
.menu-btn .menu-chev { width: 18px; height: 18px; margin-left: auto; color: var(--ink-3); }
.menu-t { min-width: 0; display: grid; line-height: 1.25; }
.menu-g { font-size: .8125rem; font-weight: 700; color: var(--brass-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-s { font-size: var(--t-label); font-weight: 800; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-btn:hover { background-image: linear-gradient(var(--hover), var(--hover)); }
.menu-btn:active { background-image: linear-gradient(var(--press), var(--press)); }
.menu-btn[aria-expanded="true"] { border-color: var(--primary); }
.tool {
  min-height: 44px; min-width: 44px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-btn);
  background: var(--surface); color: var(--ink-2);
  font-size: var(--t-label); font-weight: 600; cursor: pointer;
}
.tool[aria-pressed="true"], .tool[aria-expanded="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
}

/* ── 이야기 전체 보기 창(☰) ─────────────────────────────────────────── */
.all-hd { flex: 1 1 auto; min-width: 0; margin-left: 4px; }
.all-brand { margin: 0; font-size: var(--t-caption); font-weight: 700; color: var(--brass-text); }
.all-h { margin: 0; font-size: 1.25rem; font-weight: 800; }
.quiz-end { margin: 14px 0 0; }
.quiz-end .step-btn { width: 100%; min-height: 48px; text-decoration: none; color: var(--primary-heavy); border: 2px solid var(--primary); background: var(--surface); justify-content: center; text-align: center; }
/* 메뉴(☰ 창 위쪽): 성경 흐름 · 장소·인물 · 복습 퀴즈 · 보는 법 · 처음 안내 다시 보기 */
.all-more { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 4px 14px 12px; border-bottom: 1px solid var(--line); }
.menu-link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--primary); background: var(--surface); background-clip: padding-box; cursor: pointer;
  font: inherit; font-size: var(--t-label); font-weight: 700; color: var(--primary-heavy); text-decoration: none; white-space: nowrap;
}
.menu-link:hover { background-image: linear-gradient(var(--hover), var(--hover)); }
.menu-link:active { background-image: linear-gradient(var(--press), var(--press)); }
.all-list { overflow-y: auto; min-height: 0; overscroll-behavior: contain; padding: 4px 14px 18px; }
.all-g h3 { margin: 12px 2px 8px; font-size: var(--t-label); font-weight: 800; color: var(--ink); }
.all-g h3 span { margin-left: 6px; font-size: var(--t-caption); font-weight: 600; color: var(--brass-text); }
.all-g ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 8px; }
.all-item {
  width: 100%; height: 100%; text-align: left; display: grid; grid-template-columns: auto 1fr; gap: 0 10px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer;
  font-size: var(--t-label); color: var(--ink-2);
}
.all-item .no { grid-row: 1 / span 2; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--c); color: #fff; font-weight: 800; font-size: .9375rem; font-variant-numeric: tabular-nums; }
.all-item .t { font-weight: 700; color: var(--ink); line-height: 1.35; }
.all-item .r { font-size: var(--t-caption); color: var(--ink-3); line-height: 1.4; }
.all-item:hover { background-image: linear-gradient(var(--hover), var(--hover)); }
.all-item:active { background-image: linear-gradient(var(--press), var(--press)); }
.all-item[aria-current="true"] { border-color: var(--c); box-shadow: inset 0 0 0 2px var(--c); }
@media (max-width: 600px) { .search.all { padding: 0; } .search.all .search-box { border-radius: 0; height: 100%; } }
/* ── 지도 ──────────────────────────────────────────────────────────── */
/* 휴대폰: 지도를 조금 줄여 장면 카드(장소·제목)가 첫 화면에 들어오게 한다 */
.map-wrap { position: relative; height: clamp(260px, 40svh, 560px); background: var(--sea); }
#map { position: absolute; inset: 0; }
@media (min-width: 960px) { .map-wrap { height: 100%; } }
/* 휴대폰·태블릿: 지도 앱처럼 지도가 위에 붙어 있고 카드만 그 밑으로 넘어간다(읽는 동안에도 지금 장소가 보인다).
   머리와 이야기 줄은 위로 밀려 올라가고, 다시 올리면 나온다 */
@media (max-width: 959px) {
  .map-wrap { position: sticky; top: 0; z-index: 3; height: clamp(250px, 44svh, 560px); box-shadow: 0 8px 14px -12px rgba(20,38,74,.45); }
}
/* 2026-11-09 사용자 요청: 휴대폰 세로도 화면 한 장으로. 문서 전체가 스크롤되면 머리(이름·이야기 단추)가 위로 밀려 사라지고
   카드 제목이 지도 밑으로 반쯤 들어가 보기 이상했다. 이제 [머리 → 지도 → 카드(이것만 스크롤) → 아래 막대]가 제자리에 있다.
   (휴대폰 가로는 아래 '가로로 눕히면' 규칙이 나란히 배치로 덮어쓴다) */
@media (max-width: 959px) {
  html, body { height: 100%; overflow: hidden; }
  .app { height: 100%; min-height: 0; grid-template-rows: auto auto minmax(0, 1fr); }
  .map-wrap { position: relative; top: auto; z-index: auto; height: clamp(220px, 40svh, 520px); }
  .panel { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  /* 이름 줄은 한 줄로 낮게: 로고 · 복음의 길 · 성경을 길로 읽다 */
  .masthead { padding-block: 8px; row-gap: 6px; }
  .brand-line { gap: 8px; }
  .brand-line .logo { width: 26px; height: 26px; }
  .brand-w { flex-direction: row; align-items: baseline; gap: 8px; }
  .brand-t { font-size: 1.0625rem; }
  .brand-s { font-size: .8125rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .menu-btn, .tool-search { min-height: 48px; }
}
/* 2026-11-13 사용자 의견(카톡 안 브라우저에서 본문이 한두 줄만 보임): 휴대폰 세로는 자리가 좁다.
   ① 카드 제목은 고정하지 않는다(가로로 눕혀도 같음. 아래 막대에 '몇 번째 / 제목'이 늘 있다).
   ② 본문을 내려 읽으면 지도가 낮아지고, 맨 위로 올리거나 장면을 넘기면 다시 커진다(지도 앱의 목록 끌어올리기처럼) */
@media (max-width: 959px) {
  .card .card-head { position: relative; top: auto; }
  .card .card-head.stuck { box-shadow: none; }
  /* 작은 제목 한 줄(아이폰 앱의 큰 제목 → 작은 제목처럼). 자리를 차지하지 않게 높이 0인 붙박이 안에 띄운다 */
  .card .card-mini { display: block; position: sticky; top: calc(-1 * var(--panel-top, 0px)); z-index: 3; height: 0; margin: 0 -20px; }
  .card-mini-in {
    position: absolute; left: 0; right: 0; top: 0; height: 42px;
    display: flex; align-items: center; gap: 8px; padding: 0 16px; cursor: pointer;
    background: var(--surface); border-top: 4px solid var(--story, var(--primary)); border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: 0 8px 10px -8px rgba(20,38,74,.3);
    opacity: 0; transform: translateY(-6px); pointer-events: none; transition: opacity .15s, transform .15s;
  }
  .card.mini-on .card-mini-in { opacity: 1; transform: none; pointer-events: auto; }
  .card-mini .num { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
    background: var(--story); color: #fff; font-size: .75rem; font-weight: 700; font-variant-numeric: tabular-nums; }
  .card-mini .num:empty { display: none; }
  .card-mini .mini-t { min-width: 0; flex: 0 1 auto; font-size: .9375rem; font-weight: 800; color: var(--ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .card-mini .mini-r { flex: 0 0 auto; font-size: .8125rem; font-weight: 700; color: var(--primary-heavy, var(--primary)); white-space: nowrap; }
  .card-mini .mini-r::before { content: "·"; margin-right: 6px; color: var(--ink-3); }
  .map-wrap { transition: height .25s ease; }
  .app.reading .map-wrap { height: clamp(140px, 22svh, 260px); }
}
@media (prefers-reduced-motion: reduce) { .map-wrap { transition: none !important; } }
.map-status {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-size: var(--t-label); color: var(--ink-3); pointer-events: none;
}
.map-status:empty { display: none; }

/* 불러오는 중: 샘물 DS처럼 스켈레톤으로 자리를 먼저 보여 준다 */
.map-skel { position: absolute; inset: 0; pointer-events: none; display: none;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.45) 50%, transparent 70%) var(--sea);
  background-size: 200% 100%; }
.app[data-loading] .map-skel { display: block; }
.app[data-loading] .key { visibility: hidden; }
.skel { height: 1em; margin: 0 0 10px; border-radius: 6px; background: var(--line-soft);
  background-image: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.7) 50%, transparent 70%); background-size: 200% 100%; }
.skel.big { height: 1.5em; }
.story-head .skel { margin: 0 0 8px; }
.skel.w40 { width: 40%; } .skel.w50 { width: 50%; } .skel.w60 { width: 60%; } .skel.w70 { width: 70%; } .skel.w80 { width: 80%; } .skel.w90 { width: 90%; }
@media (prefers-reduced-motion: no-preference) {
  .map-skel, .skel { animation: shimmer 1.4s linear infinite; }
  @keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
}

/* 지도 위 상시 범례 */
.key {
  position: absolute; z-index: 2;
  left: max(10px, env(safe-area-inset-left, 0px)); bottom: 10px;
  display: flex; flex-direction: column; gap: 4px;
  max-width: calc(100% - 20px);
  padding: 6px 10px; border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);  /* 뒤 지도가 비치되 글은 읽히게 */
  box-shadow: 0 1px 4px rgba(20,38,74,.15);
  font-size: .8125rem; font-weight: 600; color: var(--ink-2); line-height: 1.3;
}
.key span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
/* 이름 표기 줄: [보기][뜻]이 한 쌍으로 읽히게 쌍 사이에 세로 선, 뜻은 작고 옅게 */
.key .names > span + span { padding-left: 10px; border-left: 1px solid var(--line, #D9D3C7); }
.key .names small { font-size: .75rem; font-weight: 500; color: var(--ink-3, #5B5A57); }
.key .row { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.key .old-s { color: var(--old-map); letter-spacing: .2em; font-weight: 700; }
.key .geo-s { color: #3D6A73; font-weight: 700; }
.key .now-s { color: var(--now-map); font-weight: 700; font-size: .6875rem; padding: 0 4px; border: 1.5px solid color-mix(in srgb, var(--now-map) 55%, transparent); border-radius: 4px; }
@media (max-width: 500px) { .key { font-size: .75rem; gap: 2px; padding: 5px 8px; } .key .row { gap: 2px 10px; } }
/* 범례 접기 단추(휴대폰·PC). 접으면 작은 [보는 법] 칩 하나만 남아 지도가 넓어진다 */
.key-toggle {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  min-height: 44px; margin: -6px -10px 0; padding: 0 12px;
  border: 0; background: none; cursor: pointer;
  font-size: var(--t-label); font-weight: 700; color: var(--ink-2);
}
.key-toggle .ic { width: 1em; height: 1em; }
.key-body { display: flex; flex-direction: column; gap: 4px; }
.key.closed { padding: 0; border-radius: 999px; }
.key.closed .key-toggle { margin: 0; padding: 0 14px; font-size: .9375rem; }
.key.closed .key-body { display: none; }
@media (max-width: 500px) { .key-body { gap: 2px; } .key-toggle { margin: -5px -8px 0; } }
.k { display: inline-block; flex: 0 0 auto; }
.k.solid, .k.dash { width: 26px; height: 0; border-top: 3.5px solid var(--story, var(--primary)); }
.k.dash { border-top-style: dashed; }
.k.future { width: 26px; height: 0; border-top: 2px solid var(--future); }
.k.back { width: 26px; height: 0; border-top: 3.5px solid color-mix(in srgb, var(--story, var(--primary)) 40%, #fff); }
.k.num {
  width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center;
  background: var(--story, var(--primary)); color: #fff; font-style: normal; font-size: .75rem; font-weight: 700;
}

/* 장소 표식: 바깥 상자(26px)의 가운데가 실제 위치. 이름은 오른쪽에 붙는다.
   위치는 MapLibre가 정한다(position: absolute). 덮어쓰지 말 것 */
.pin {
  width: 26px; height: 26px; padding: 0; border: 0; background: none; cursor: pointer;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: .9375rem; color: var(--ink-3); letter-spacing: -.01em;
}
.pin::before { /* 손가락으로 누르기 쉬운 넓은 영역 */
  content: ""; position: absolute; left: -10px; top: -11px; width: 46px; height: 48px;
}
.pin .dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 2.5px solid var(--line-strong);
  display: grid; place-items: center;
  font-family: var(--font-ui); font-size: .75rem; font-weight: 700; line-height: 1; color: var(--story);
  font-variant-numeric: tabular-nums;
}
/* 겹쳐서 옆으로 비킨 번호에서 실제 위치까지 잇는 가는 선 */
.pin .lead {
  display: none; position: absolute; left: 50%; top: 50%; height: 1.5px; margin-top: -.75px; z-index: -1;
  background: var(--ink-3); transform-origin: 0 50%; pointer-events: none;
}
/* 선 끝의 점 = 실제 위치. 흰 테두리를 둘러 선·길 위에서도 보이게 */
.pin .lead::after { content: ""; position: absolute; right: -4px; top: -3.25px; width: 8px; height: 8px; box-sizing: border-box; border-radius: 50%; background: var(--ink-2); border: 1.5px solid #fff; }
.pin .name {
  position: absolute; left: 30px; top: 50%; transform: translateY(-50%);
  white-space: nowrap; line-height: 1.2; pointer-events: none;
  paint-order: stroke fill; -webkit-text-stroke: 4px var(--land);
  text-shadow: 0 0 2px var(--land), 0 0 6px var(--land);
}
.pin.hide-label .name { display: none; }
/* 번호 줄에서 누른 장소: 3초 동안 번호 둘레에 고리를 그려 찾기 쉽게 한다 */
.pin.flash { z-index: 5 !important; }
.pin.flash .dot { box-shadow: 0 0 0 4px #fff, 0 0 0 8px var(--story); }
.pin.flash .name { font-size: 1.0625rem; color: var(--ink); }
@media (prefers-reduced-motion: no-preference) {
  .pin.flash .dot { animation: flash 1s ease-in-out 3; }
  @keyframes flash { 50% { box-shadow: 0 0 0 4px #fff, 0 0 0 14px color-mix(in srgb, var(--story) 35%, transparent); } }
}
/* 휴대폰 전체 보기에서 몰린 번호를 하나로 묶은 단추: "3·5·6·7" + "가버나움 둘레 4곳" */
.cluster {
  position: absolute; z-index: 4; transform: translate(-50%, -50%);
  display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; padding: 0;
  border: 0; background: none; cursor: pointer; font-family: var(--font-ui);
}
.cluster .cn {
  display: inline-grid; place-items: center; height: 30px; padding: 0 10px; border-radius: 999px;
  background: #fff; color: var(--story); border: 2.5px solid var(--story);
  box-shadow: 0 0 0 2px #fff, 0 1px 6px rgba(0,0,0,.25);
  font-size: .875rem; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.cluster .cname {
  position: absolute; left: calc(100% - 4px); top: 50%; transform: translateY(-50%);
  white-space: nowrap; font-size: .9375rem; font-weight: 700; color: var(--ink-2); line-height: 1.2;
  paint-order: stroke fill; -webkit-text-stroke: 4px var(--land); text-shadow: 0 0 2px var(--land), 0 0 6px var(--land);
  pointer-events: none;
}
/* 묶음 이름 자리: 오른쪽(기본) · 왼쪽 · 아래 · 위, 자리가 없으면 단추 안에 두 줄 */
.cluster.side-l .cname { left: auto; right: calc(100% - 4px); }
.cluster.side-b .cname, .cluster.side-t .cname { left: 50%; transform: translateX(-50%); }
.cluster.side-b .cname { top: calc(50% + 1.05rem); }
.cluster.side-t .cname { top: auto; bottom: calc(50% + 1.05rem); }
.cluster.side-in { padding: 3px 10px 4px; border-radius: 14px; background: #fff; border: 2.5px solid var(--story); box-shadow: 0 0 0 2px #fff, 0 1px 6px rgba(0,0,0,.25); }
.cluster.side-in .cn { height: auto; padding: 0; border: 0; box-shadow: none; }
.cluster.side-in .cname { position: static; transform: none; -webkit-text-stroke: 0; text-shadow: none; font-size: .875rem; color: var(--ink); }
.cluster:hover .cn, .cluster:active .cn { background-image: linear-gradient(var(--hover), var(--hover)); }
/* 오른쪽이 막혀 왼쪽·위·아래에 붙인 이름(layoutLabels) */
.pin.name-l .name { left: auto; right: 30px; }
.pin.name-t .name, .pin.name-b .name { left: 50%; transform: translateX(-50%); }
.pin.name-t .name { top: auto; bottom: 28px; }
.pin.name-b .name { top: 28px; }
/* 떨어진 자리에 쓴 이름(꼭 알아야 하는 곳만): 위치는 layoutLabels가 정하고, 번호 원에서 가는 선으로 잇는다 */
.pin .nlead { display: none; position: absolute; left: 50%; top: 50%; height: 1.5px; margin-top: -.75px; z-index: -1;
  background: var(--ink-3); transform-origin: 0 50%; pointer-events: none; }
.pin.name-far .nlead { display: block; }
.pin.name-far .name { transform: none; }
.pin.name-tr .name, .pin.name-tl .name, .pin.name-br .name, .pin.name-bl .name { transform: none; }
.pin.name-tr .name { left: 21px; top: auto; bottom: 28px; }
.pin.name-tl .name { left: auto; right: 21px; top: auto; bottom: 28px; }
.pin.name-br .name { left: 21px; top: 28px; }
.pin.name-bl .name { left: auto; right: 21px; top: 28px; }
.pin.dim { color: var(--dim-ink); }   /* 투명도 대신 회색 글씨(대비 유지) */
.pin.dim .dot { width: 9px; height: 9px; border-width: 2px; border-color: #B5AFA2; }
.pin.dim .name { font-size: .8125rem; }
.pin.in-story { color: var(--ink-2); }
.pin.in-story .dot { border-color: var(--story); }
.pin.numbered .dot { width: 24px; height: 24px; border-width: 2.5px; background: #fff; }
.pin.visited .dot { background: var(--story); color: #fff; }
.pin.current { color: var(--ink); font-size: 1.125rem; font-weight: 800; }
.pin.current .name { left: 34px; -webkit-text-stroke: 5px #fff; text-shadow: 0 0 3px #fff, 0 0 8px #fff; }
.pin.current.name-l .name { left: auto; right: 34px; }   /* 오른쪽 끝에서 잘릴 때만 왼쪽에(layoutLabels) */
.pin.current .dot {
  width: 30px; height: 30px; font-size: .875rem;
  background: var(--story); color: #fff; border: 3px solid #fff;
  box-shadow: 0 0 0 3px var(--story), 0 2px 8px rgba(0,0,0,.25);
}
@media (prefers-reduced-motion: no-preference) {
  .pin.current .dot { animation: pulse 2.4s ease-out infinite; }
  @keyframes pulse {
    0% { box-shadow: 0 0 0 3px var(--story), 0 0 0 3px color-mix(in srgb, var(--story) 45%, transparent); }
    70% { box-shadow: 0 0 0 3px var(--story), 0 0 0 18px transparent; }
    100% { box-shadow: 0 0 0 3px var(--story), 0 0 0 18px transparent; }
  }
}
.region {   /* 성경 시대 지방 이름 */
  font-family: var(--font-ui); font-weight: 600;
  font-size: .875rem; letter-spacing: .3em; color: var(--old-map);
  pointer-events: none; white-space: nowrap;
  text-shadow: 0 0 3px var(--land), 0 0 6px var(--land);
}
.region.sea { color: var(--sea-label); font-size: 1.125rem; letter-spacing: .6em; text-shadow: none; }
.landmark {  /* 오늘날에도 잘 알려진 바다·호수·강·산 */
  font-family: var(--font-ui); font-weight: 600; font-size: .8125rem; letter-spacing: .08em;
  color: #3D6A73; pointer-events: none; white-space: nowrap;
  text-shadow: 0 0 3px var(--sea), 0 0 6px var(--sea);
}
.landmark.sea { font-size: 1rem; letter-spacing: .5em; color: var(--sea-label); text-shadow: none; }
.landmark.river { text-shadow: 0 0 3px var(--land), 0 0 6px var(--land); }
.landmark.mountain { color: #6E655A; text-shadow: 0 0 3px var(--land), 0 0 6px var(--land); }
.landmark.mountain::before { content: "▲ "; font-size: .7em; color: #8A8073; }
.country {  /* 오늘날 나라 이름: 네모 테두리로 성경 시대 이름과 구분 */
  font-family: var(--font-ui); font-weight: 700; font-size: .75rem; letter-spacing: .06em;
  color: var(--now-map); pointer-events: none; white-space: nowrap;
  padding: 1px 6px; border: 1.5px solid color-mix(in srgb, var(--now-map) 55%, transparent); border-radius: 4px;
  background: color-mix(in srgb, var(--land) 80%, transparent);
}

/* 지도 단추도 손가락 크기(48px) */
.maplibregl-ctrl-group button { width: 48px; height: 48px; }

/* ── 카드 패널 ─────────────────────────────────────────────────────── */
.panel {
  --panel-top: 18px;   /* 카드 머리(.card-head)가 이만큼 위로 붙어 카드 칸 맨 위에 딱 닿게 한다 */
  display: flex; flex-direction: column; gap: 14px;
  padding-block: var(--panel-top) 0;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
/* 이어 보기 권유(카드 위, 한 번): 옅은 초록 바탕 + 주 단추 */
.resume {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px;
  padding: 14px 16px; border-radius: var(--radius); background: var(--tint);
  border: 1px solid color-mix(in srgb, var(--primary) 30%, #fff);
}
.resume-t { min-width: 0; flex: 1 1 220px; }
.resume-h { margin: 0; font-size: var(--t-label); font-weight: 800; color: var(--primary-heavy); }
.resume-what { margin: 2px 0 0; font-size: var(--t-caption); color: var(--ink-2); line-height: 1.45; }
.resume-btns { display: flex; gap: 8px; flex: 0 0 auto; }
.resume-go, .resume-x {
  display: inline-flex; align-items: center; gap: 4px; min-height: 48px; padding: 0 16px; border-radius: var(--radius-btn);
  font-size: var(--t-label); font-weight: 700; cursor: pointer;
}
.resume-go { border: 1px solid var(--primary); background: var(--primary); color: #fff; }
.resume-x { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); }
.resume-go:hover, .resume-x:hover { background-image: linear-gradient(var(--hover), var(--hover)); }
.resume-go:active, .resume-x:active { background-image: linear-gradient(var(--press), var(--press)); }
@media (max-width: 420px) { .resume-btns { width: 100%; } .resume-go { flex: 1 1 auto; justify-content: center; } }
.story-head .eyebrow {
  margin: 0; font-size: var(--t-caption); font-weight: 700; color: var(--brass-text); letter-spacing: .02em;
}
.story-head h2 {
  margin: 2px 0 4px; font-family: var(--font-display); font-weight: 800;
  font-size: var(--t-heading); line-height: 1.3; text-wrap: balance;
}
.story-head p { margin: 0; color: var(--ink-3); font-size: var(--t-label); }
/* 이야기 소개는 첫 장면에서만(휴대폰·PC 같음). 다음 장면부터는 장면 카드가 바로 보이게 한다. 이야기 이름은 머리 [☰]에 늘 있다 */
.panel[data-first="false"] .story-head { display: none; }

@media (prefers-reduced-motion: no-preference) {
  .card.in-next { animation: card-in-next .28s cubic-bezier(.2,.7,.3,1); }
  .card.in-prev { animation: card-in-prev .28s cubic-bezier(.2,.7,.3,1); }
  @keyframes card-in-next { from { opacity: .3; transform: translateX(28px); } }
  @keyframes card-in-prev { from { opacity: .3; transform: translateX(-28px); } }
}
.card {
  padding: 0 20px 18px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
}
/* 카드 머리(제목 + 장소·장절): 본문을 내려 읽어도 카드 칸 맨 위에 붙어 있다(2026-11-10). 이야기 색 띠도 머리에 둔다 */
.card-head {
  position: sticky; top: calc(-1 * var(--panel-top, 0px)); z-index: 2;
  margin: 0 -20px; padding: 20px 20px 2px;
  background: var(--surface);
  border-top: 5px solid var(--story, var(--primary));
  border-radius: var(--radius) var(--radius) 0 0;
  transition: box-shadow .15s;
}
.card-head .where-row { margin-bottom: 4px; }
.card-mini { display: none; }   /* 넓은 화면은 큰 머리가 붙어 있어 필요 없다 */
.card-head.stuck { box-shadow: 0 8px 10px -8px rgba(20,38,74,.28); }
.card[aria-busy="true"] { padding-top: 20px; border-top: 5px solid var(--story, var(--primary)); }   /* 불러오는 중(머리 없음) */
/* 장면 카드 순서: ① 제목(크게) ② 장소 · 장절 한 줄 + 꼬리표 하나 ③ 본문 ④ [본문 보기][듣기][나누기] ⑤ [더 알아보기] */
.where-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; margin: 0 0 8px; font-size: var(--t-label); }
.where-row .num {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; background: var(--story); color: #fff;
  font-weight: 700; font-size: .8125rem; font-variant-numeric: tabular-nums;
}
.where-row .num:empty { display: none; }
.where-row .place {
  position: relative; min-height: 44px; padding: 0; border: 0; background: none; cursor: pointer; text-align: left;
  font: inherit; font-weight: 800; color: var(--ink);
  text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px;
}
.where-row .place::after { content: ""; position: absolute; top: 0; bottom: 0; left: -8px; right: -8px; min-width: 44px; }   /* 두 글자 이름도 누르는 폭 44px 이상 */
.where-row .dot-sep { color: var(--ink-3); }
.where-row .ref { font-weight: 700; color: var(--primary-heavy); }
.tn { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: var(--t-label); line-height: 1.45; }
.tag {
  flex: 0 0 auto; display: inline-block; padding: 0 7px; border-radius: 5px;
  font-size: .8125rem; font-weight: 700; line-height: 1.6;
}
.tag.old { background: color-mix(in srgb, var(--old) 12%, #fff); color: var(--old); }
.tag.now { background: color-mix(in srgb, var(--now) 12%, #fff); color: var(--now); }
.tn .old-t { color: var(--old); font-weight: 600; }
.tn .now-t { display: inline; color: var(--now); margin: 0; white-space: normal; overflow: visible; font-size: inherit; line-height: inherit; }   /* 아래 단추 줄의 .now-t(한 줄 줄임)와 이름이 같아 덮어쓴다 */
.card h3:focus { outline: none; }
.card h3:focus-visible { outline: 3px solid var(--focus); }
.card h3 {
  margin: 0 0 2px; font-family: var(--font-display); font-weight: 800;
  font-size: 1.5rem; line-height: 1.3; text-wrap: balance;
}
.card .meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin: 8px 0 0; font-size: var(--t-label); }
.tag.who { background: var(--line-soft); color: var(--ink-2); }
.card .meta .when { margin: 0 8px 0 0; }
.card .when { margin-left: 8px; color: var(--brass-text); font-size: var(--t-label); font-weight: 600; white-space: nowrap; }
.story-head .when-t { margin: 0 0 4px; color: var(--brass-text); font-size: var(--t-label); font-weight: 700; }
.card .actor { color: var(--ink-2); font-size: var(--t-label); }
.card .text { margin: 0; max-width: 62ch; }
.card .note {
  margin: 12px 0 0; padding: 10px 12px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--line-soft);
  font-size: var(--t-label); color: var(--ink-2);
}
.card .note b { color: var(--brass-text); }
.card .trip { display: flex; gap: 10px; align-items: baseline; margin: 12px 0 0; font-size: var(--t-label); color: var(--ink-3); }
.trip-ic { flex: 0 0 22px; height: 0; border-top: 3.5px solid var(--story); transform: translateY(-4px); }
.trip-ic.dash { border-top-style: dashed; }
.card .more { margin: 6px 0 0; }
.card .also-ref { margin: 12px 0 0; font-size: var(--t-label); color: var(--ink-2); }
.card .also-ref b { margin-right: 6px; color: var(--ink); }
.card .also { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.card .also h4 { margin: 0 0 6px; font-size: var(--t-body); }
.card .also .also-sub { margin: 10px 0 6px; font-size: var(--t-label); font-weight: 700; color: var(--old); }
.badge {
  display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: .875rem; font-weight: 700;
  border: 1px solid currentColor;
}
.badge.sure { color: var(--primary-strong); }
.badge.likely { color: var(--brass-text); }
.badge.guess { color: #9C5800; }
.badge.order { color: #6B4FA0; vertical-align: 1px; }
.badge.theme { color: #8A2E3B; background: #FBF0F1; }   /* 언약(흰 바탕 7.9:1) */

/* 꼬리표 단추: 누르면 짧은 설명이 아래에 열린다 */
.tags { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 0 0 10px; }
.more-box .tags { margin: 10px 0 0; }
.more-box .tip { margin: 8px 0 0; }
.tagbtn {
  position: relative; display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 2px 10px;
  background: var(--surface); cursor: pointer; font: inherit; font-size: .9375rem; font-weight: 700; line-height: 1.3; text-align: left;
  background-clip: padding-box; border-width: 1.5px;
}
.tagbtn .ic { width: 1em; height: 1em; stroke-width: 2.2; }
.tagbtn::before { content: ""; position: absolute; inset: -6px -2px; }   /* 누르는 자리는 44px(글씨는 작게) */
.tags.one .tagbtn { font-size: .875rem; }
.tagbtn[aria-expanded="true"] { background-image: linear-gradient(var(--press), var(--press)); }
.tagbtn:hover { background-image: linear-gradient(var(--hover), var(--hover)); }
.tagbtn.theme { background: #FBF0F1; }
.tip {
  margin: 0 0 10px; padding: 10px 12px; border-radius: 10px; max-width: 62ch;
  background: var(--bg); border: 1px solid var(--line-soft);
  font-size: var(--t-label); line-height: 1.55; color: var(--ink-2);
}
.tip b { color: var(--ink); }
.story-head .tip { margin: 6px 0 4px; }
/* [이야기 소개 ▸]: 성경 범위·소개 글·앞 이야기와 이어져요·연도 설명을 접어 둔다 */
.story-more { margin: 2px 0 0; }
.story-more > summary {
  list-style: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; cursor: pointer;
  font-size: var(--t-label); font-weight: 800; color: var(--primary-strong);
}
.story-more > summary::-webkit-details-marker { display: none; }
.story-more > summary .ic { width: 1em; height: 1em; transition: transform .2s; }
.story-more[open] > summary .ic { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .story-more > summary .ic { transition: none; } }
.story-more .range { margin: 0 0 6px; font-size: var(--t-caption); font-weight: 700; color: var(--brass-text); }
.story-more .tags { margin: 0 0 6px; }
.story-head .bridge {
  margin: 8px 0 0; padding: 8px 12px; border-left: 4px solid var(--story, var(--primary)); border-radius: 0 8px 8px 0;
  background: var(--surface); color: var(--ink-2); font-size: var(--t-label); line-height: 1.55;
}
.story-head .bridge b { display: block; color: var(--ink); font-size: var(--t-caption); }

/* 장절 옆 "성경 본문 보기"(대한성서공회, 새 탭) */
.card .ref-row { margin: 0 0 10px; }
.card .ref-row .ref { margin: 0 4px 0 0; }
.bible-link {
  display: inline-flex; align-items: center; gap: 4px; min-height: 44px; vertical-align: middle; margin-right: 4px;
  font-size: var(--t-label); font-weight: 700; color: var(--primary-strong); text-decoration: underline; text-underline-offset: 3px;
}
.bible-link .ic { width: .95em; height: .95em; }

/* 장면 카드의 들려주기·나누기 */
.card-acts { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.act {
  display: inline-flex; align-items: center; gap: 7px; min-height: 48px; padding: 0 14px; text-decoration: none;
  border: 1px solid var(--line-strong); border-radius: var(--radius-btn); background: var(--surface); background-clip: padding-box;
  font: inherit; font-size: var(--t-label); font-weight: 700; color: var(--ink-2); cursor: pointer;
}
.act[hidden] { display: none; }
.act:hover { background-image: linear-gradient(var(--hover), var(--hover)); }
.act:active { background-image: linear-gradient(var(--press), var(--press)); }
.act[aria-pressed="true"] { border-color: var(--primary); color: var(--primary-heavy); background-color: var(--tint); }

/* 더 알아보기(접힘): 옛 이름·오늘날, 사람·연도, 온 길, 메모, 함께 읽을 곳, 언약, 이곳의 다른 이야기 */
.more-box { margin: 14px 0 0; border-top: 1px solid var(--line-soft); }
.more-box > summary {
  list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; min-height: 48px; padding: 4px 0 0; cursor: pointer;
  font-size: var(--t-label); font-weight: 800; color: var(--primary-strong);
}
.more-box > summary::-webkit-details-marker { display: none; }
.more-box > summary .ic { width: 1em; height: 1em; transition: transform .2s; }
.more-box[open] > summary .ic { transform: rotate(90deg); }
.more-box .more-hint { flex: 1 1 100%; margin-top: -4px; font-size: var(--t-caption); font-weight: 600; color: var(--ink-3); }
.more-box[open] .more-hint { display: none; }
.more-box > .tn:first-of-type { margin-top: 4px; }
@media (prefers-reduced-motion: reduce) { .more-box > summary .ic { transition: none; } }

/* 언약 장면 이어 보기 */
.card .theme-nav { margin: 14px 0 0; padding: 12px; border-radius: 12px; background: #FBF0F1; border: 1px solid #EBCFD3; }
.card .theme-nav h4 { margin: 0 0 8px; font-size: var(--t-body); color: #8A2E3B; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.card .theme-nav h4 .cnt { font-size: var(--t-caption); font-weight: 600; color: var(--ink-3); }
.theme-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 8px; }
.theme-btn {
  display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 8px 12px; text-align: left;
  border: 1px solid #D9AEB5; border-radius: var(--radius-btn); background: var(--surface); background-clip: padding-box;
  font: inherit; color: var(--ink); cursor: pointer;
}
.theme-btn.next { justify-content: space-between; }
.theme-btn > span { min-width: 0; display: grid; }
.theme-btn b { font-size: var(--t-label); color: #8A2E3B; }
.theme-btn .s { font-size: var(--t-caption); color: var(--ink-2); overflow-wrap: anywhere; }
.theme-btn .ic { color: #8A2E3B; }
.theme-btn:hover { background-image: linear-gradient(var(--hover), var(--hover)); }
.theme-btn:active { background-image: linear-gradient(var(--press), var(--press)); }

/* 짧은 알림("복사했어요"): 아래 단추 줄 위에 잠깐 뜬다 */
.toast {
  position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom, 0px)); z-index: 60; transform: translateX(-50%);
  max-width: min(92vw, 420px); padding: 12px 18px; border-radius: 12px;
  background: var(--ink); color: #fff; font-size: var(--t-label); font-weight: 700; line-height: 1.45; text-align: center;
  box-shadow: var(--shadow-raised);
}
.toast[hidden] { display: none; }

/* 아래에 붙은 막대(장면 넘기기는 이것 하나): 얇은 칸 진행 막대 + [이전] [몇 번째 / 제목 ▾] [다음] */
.stepper {
  position: sticky; bottom: 0; z-index: 4; order: 4; margin-top: auto;   /* 넓은 화면: 카드가 짧아도 패널 맨 아래에 붙는다 */
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px;
  margin-inline: calc(-1 * max(16px, env(safe-area-inset-left, 0px))) calc(-1 * max(16px, env(safe-area-inset-right, 0px)));
  padding-block: 0 calc(8px + env(safe-area-inset-bottom, 0px));
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--line-soft);
}
/* 장면 수만큼 칸으로 나눈 얇은 진행 막대(스토리처럼). 칸이 많아도 한 줄 */
.stepper .bar {
  grid-column: 1 / -1; height: 4px; margin: 0 0 4px; background: var(--line-soft); overflow: hidden;
  margin-inline: calc(-1 * max(12px, env(safe-area-inset-left, 0px))) calc(-1 * max(12px, env(safe-area-inset-right, 0px)));
}
.stepper .bar[style*="--n"] {
  -webkit-mask-image: repeating-linear-gradient(to right, #000 0 calc(100% / var(--n) - 2px), transparent calc(100% / var(--n) - 2px) calc(100% / var(--n)));
  mask-image: repeating-linear-gradient(to right, #000 0 calc(100% / var(--n) - 2px), transparent calc(100% / var(--n) - 2px) calc(100% / var(--n)));
}
.stepper .bar i { display: block; height: 100%; width: 0; background: var(--story, var(--primary)); }
@media (prefers-reduced-motion: no-preference) { .stepper .bar i { transition: width .4s ease; } }
.stepper .step-btn { min-height: 52px; min-width: 84px; padding: 0 12px; font-size: var(--t-label); line-height: 1.2; }
.stepper .step-btn .ic { width: 1.1em; height: 1.1em; }
/* 가운데: 몇 번째 / 제목(한 줄 줄임) ▴ — 누르면 장면 목록 */
.step-now {
  min-width: 0; min-height: 52px; display: flex; align-items: center; gap: 6px; padding: 4px 8px;
  border: 0; border-radius: var(--radius-btn); background: none; cursor: pointer; text-align: left; color: var(--ink-3);
}
.step-now:hover { background-image: linear-gradient(var(--hover), var(--hover)); }
.step-now:active, .step-now[aria-expanded="true"] { background-image: linear-gradient(var(--press), var(--press)); }
.step-now .ic { width: 1em; height: 1em; color: var(--ink-3); }
.now-t { flex: 1 1 auto; min-width: 0; display: grid; line-height: 1.3; }
.now-t .cnt { font-size: var(--t-caption); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.now-t .cnt b { color: var(--ink); }
.now-t .tt { font-size: var(--t-label); font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pause {
  grid-column: 1 / -1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-btn); background: var(--surface);
  font-size: var(--t-label); font-weight: 700; color: var(--ink-2); cursor: pointer;
}
.pause .ic { width: .8em; height: .8em; }
.step-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 56px; padding: 0 16px; border-radius: var(--radius-btn);
  border: 1px solid var(--line-strong); background: var(--surface);
  font-size: var(--t-body); font-weight: 700; cursor: pointer; color: var(--ink-2);
}
.step-btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
/* 누를 수 없는 단추: 흐리게 지우지 않고 점선 테두리 + 읽을 수 있는 글씨("첫 장면이에요") */
.step-btn:disabled, .step-btn.primary:disabled { cursor: default; background: transparent; border: 1.5px dashed var(--line-strong); color: var(--ink-3); font-size: var(--t-label); }
.link {
  min-height: 44px; padding: 0; border: 0; background: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--t-label); font-weight: 700; color: var(--primary-strong);
  text-decoration: underline; text-underline-offset: 3px;
}
.link .ic { width: .9em; height: .9em; }
@media (min-width: 960px) { .panel { padding-bottom: 0; } }

.step-list {
  list-style: none; margin: 0; padding: 0 10px 12px;
  display: grid; gap: 2px; overflow-y: auto; min-height: 0; overscroll-behavior: contain;
}
.step-list button {
  width: 100%; display: grid; grid-template-columns: 2.2em minmax(0, 1fr); gap: 2px 8px; align-items: baseline;
  min-height: 48px; text-align: left; padding: 10px 8px; border: 0; border-radius: 10px; background: none; cursor: pointer;
  font-size: var(--t-label);
}
.step-list .n { color: var(--ink-3); font-variant-numeric: tabular-nums; text-align: right; }
.step-list .t { font-weight: 600; color: var(--ink-2); }
.step-list .r { grid-column: 2; color: var(--ink-3); font-size: var(--t-caption); }
.step-list [aria-current="step"] { background: var(--tint); }
.step-list [aria-current="step"] .t { color: var(--primary-heavy); }

/* ── 장소 카드(누르면 열림) ─────────────────────────────────────────── */
.sheet {
  position: fixed; z-index: 20;
  left: 0; right: 0; bottom: 0;
  max-height: 72svh; overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 40px -10px rgba(20,38,74,.35);
}
@media (min-width: 960px) {
  .sheet {
    left: auto; right: 24px; top: 24px; bottom: auto; width: 400px; max-height: calc(100% - 130px);   /* 아래 범례를 가리지 않게 위쪽에 */
    border-radius: var(--radius);
  }
}
.sheet-inner {
  padding-block: 18px 20px;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}
.sheet .top { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.sheet h2 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; line-height: 1.25; }
.sheet .en { color: var(--ink-3); font-size: var(--t-caption); margin: 0 0 8px; }
.sheet .close {
  flex: 0 0 auto; min-width: var(--tap); min-height: var(--tap);
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surface); cursor: pointer; font-size: 1.25rem;
}
.sheet-dim { position: fixed; inset: 0; z-index: 19; background: var(--dim); }
@media (min-width: 960px) { .sheet-dim { display: none; } }
.sheet dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; margin: 8px 0 12px; font-size: var(--t-label); }
.sheet dt { color: var(--ink-3); }
.sheet dd { margin: 0; }
.sheet h3 { margin: 16px 0 6px; font-size: var(--t-body); }
.sheet ul, .story-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sheet li button, .story-items li button {
  width: 100%; text-align: left; display: grid; gap: 0; padding: 10px 12px;
  border: 1px solid var(--line); border-left: 5px solid var(--c); border-radius: 10px;
  background: var(--surface); cursor: pointer; font-size: var(--t-label);
}
.sheet li .cur, .story-items li .cur {
  display: grid; padding: 10px 12px; border-radius: 10px; font-size: var(--t-label);
  background: var(--tint); border: 1px solid var(--line); border-left: 5px solid var(--c);
}
.sheet li .here, .story-items li .here { justify-self: start; margin-top: 4px; padding: 0 8px; border-radius: 6px; background: var(--primary); color: #fff; font-size: .875rem; font-weight: 700; }
.sheet li .s, .story-items li .s { color: var(--ink-3); font-size: var(--t-caption); }
.sheet li .t, .story-items li .t { font-weight: 700; }
.sheet ul.places { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.sheet ul.places button { --c: var(--old); }
.sheet .note { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--bg); font-size: var(--t-label); }

.noscript { padding: 24px; }
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}

/* ── 처음 안내 ─────────────────────────────────────────────────────── */
.intro {
  position: fixed; inset: 0; z-index: 30;
  display: grid; place-items: center;
  padding-block: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: var(--dim);
  overflow-y: auto;
}
.intro-box {
  position: relative;
  width: min(560px, 100%);
  padding: 28px 26px 22px; border-radius: 20px;
  background: var(--surface); box-shadow: var(--shadow-raised);
}
.intro-eyebrow { margin: 0; font-size: var(--t-caption); font-weight: 700; color: var(--brass-text); }
.intro h2 {
  margin: 4px 0 12px; font-family: var(--font-display); font-weight: 800;
  font-size: 1.75rem; line-height: 1.3; color: var(--primary-heavy); text-wrap: balance;
}
.intro-lead { margin: 0 0 6px; color: var(--ink-2); }
.intro blockquote {
  margin: 0 0 16px; padding: 12px 16px; border-radius: 12px;
  background: var(--tint); color: var(--primary-heavy);
  font-family: var(--font-display); font-weight: 600; font-size: 1.0625rem; line-height: 1.6;
}
.intro blockquote cite { display: block; margin-top: 4px; font-family: var(--font-ui); font-style: normal; font-size: var(--t-caption); color: var(--ink-3); font-weight: 600; }
.intro .arc {
  list-style: none; margin: 0 0 18px; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px;
}
.intro .arc li {
  position: relative; display: grid; gap: 0; padding: 8px 10px 8px 12px;
  border-radius: 10px; background: var(--bg); border: 1px solid var(--line-soft);
  font-size: var(--t-label);
}
.intro .arc li b { font-family: var(--font-display); color: var(--ink); line-height: 1.3; }
.intro .arc li span { font-size: var(--t-caption); color: var(--ink-3); }
.intro .arc li + li::before {   /* 흐름 화살표: 글자 대신 테두리로 그린 꺾쇠 */
  content: ""; position: absolute; left: -7px; top: 50%; width: 7px; height: 7px;
  border-top: 2px solid var(--brass-text); border-right: 2px solid var(--brass-text);
  transform: translate(-25%, -50%) rotate(45deg);
}
.intro h3 { margin: 0 0 8px; font-size: var(--t-body); }
.intro .how { margin: 0 0 14px; padding-left: 1.4em; display: grid; gap: 6px; }
.intro .how li::marker { font-weight: 700; color: var(--primary); }
.intro-key { list-style: none; margin: 0 0 18px; padding: 12px 14px; display: grid; gap: 8px; border-radius: 12px; border: 1px solid var(--line-soft); font-size: var(--t-label); color: var(--ink-2); --story: var(--primary); }
.intro-key li { display: flex; align-items: center; gap: 10px; }
/* 시작 단추는 안내가 길어도 늘 화면 아래에 보이게 붙여 둔다 */
.intro-actions {
  position: sticky; bottom: -22px; z-index: 1;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 16px -26px -22px; padding: 12px 26px calc(14px + env(safe-area-inset-bottom, 0px));
  background: var(--surface); border-top: 1px solid var(--line-soft); border-radius: 0 0 20px 20px;
}
.intro-close {
  position: absolute; top: 12px; right: 12px;
  width: var(--tap); height: var(--tap); display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink-2); cursor: pointer; font-size: 1.25rem;
}
.intro-eyebrow { padding-right: 52px; }
.intro-actions .step-btn { flex: 1 1 220px; }
@media (max-width: 420px) {
  .intro-box { padding: 22px 18px 18px; }
  .intro h2 { font-size: 1.5rem; }
  .intro .arc { grid-template-columns: 1fr; }
  .intro .arc li + li::before { left: 50%; top: -7px; transform: translate(-50%, -25%) rotate(135deg); }
  .intro-actions { margin: 16px -18px -18px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px)); bottom: -18px; }
}

.intro-key .old-s { color: var(--old); font-weight: 700; letter-spacing: .15em; white-space: nowrap; }
.intro-key .geo-s { color: #3D6A73; font-weight: 700; }
.intro-key .now-s { color: var(--now); font-weight: 700; font-size: .8125rem; padding: 0 5px; border: 1.5px solid color-mix(in srgb, var(--now) 50%, transparent); border-radius: 4px; }
.credits { margin-top: 14px; font-size: var(--t-caption); color: var(--ink-3); }
.credits summary { cursor: pointer; font-weight: 700; color: var(--ink-2); min-height: 32px; display: flex; align-items: center; }
.credits ul { margin: 6px 0 0; padding-left: 1.2em; display: grid; gap: 4px; }
.credits a { color: var(--primary-strong); }

/* ── 누름 상태(샘물 DS Interaction): 색을 바꾸지 않고 옅은 잉크를 덧씌운다. 크기 변화 없음 ── */
.tool, .step-btn, .step-list button, .sheet li button, .story-items li button, .sheet .close, .intro-close { background-clip: padding-box; }
.tool:hover:not(:disabled), .step-btn:hover:not(:disabled), .step-list button:hover,
.sheet li button:hover, .story-items li button:hover, .sheet .close:hover, .intro-close:hover { background-image: linear-gradient(var(--hover), var(--hover)); }
.tool:active:not(:disabled), .step-btn:active:not(:disabled), .step-list button:active,
.sheet li button:active, .story-items li button:active, .sheet .close:active, .intro-close:active { background-image: linear-gradient(var(--press), var(--press)); }
.intro-key .badge { flex: 0 0 auto; }
.intro-key .tag-li { align-items: flex-start; flex-wrap: wrap; gap: 4px 10px; }
.intro-key .tag-li > span:last-child { flex: 1 1 14em; }
.intro-key .when-s { color: var(--brass-text); font-weight: 700; white-space: nowrap; }
/* 축척: 배경 없이 가는 선 하나와 숫자만. 글자는 둘레를 밝게 비춰(halo) 지도 위에서도 읽힌다 */
.maplibregl-ctrl-top-right .maplibregl-ctrl-scale {
  margin: 10px 12px 0 0; padding: 0 0 2px; font: 600 .8125rem/1.3 var(--font-body, inherit); text-align: right;
  color: var(--ink-2); background: none; border: 0; border-bottom: 1.5px solid var(--ink-2); box-shadow: none;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 2px #fff;
}
/* 양 끝의 짧은 눈금(ㄴ자 막대)으로 '여기서 여기까지'가 보이게 */
.maplibregl-ctrl-top-right .maplibregl-ctrl-scale { position: relative; padding-right: 6px; }
.maplibregl-ctrl-top-right .maplibregl-ctrl-scale::before,
.maplibregl-ctrl-top-right .maplibregl-ctrl-scale::after {
  content: ""; position: absolute; bottom: -1.5px; width: 1.5px; height: 7px; background: var(--ink-2);
}
.maplibregl-ctrl-top-right .maplibregl-ctrl-scale::before { left: 0; }
.maplibregl-ctrl-top-right .maplibregl-ctrl-scale::after { right: 0; }
a.tool { display: inline-flex; align-items: center; text-decoration: none; }

/* ── 처음 안내: 시작 단추 두 개(2026-11-03 사용자 결정) ─────────────────── */
/* 주 단추 = [예수님의 탄생부터 보기](지도가 본 기능), 같은 크기의 테두리 단추 = [성경 전체 흐름 보기]. 좁은 화면에서도 나란히, 글이 길면 두 줄 */
.intro-actions { flex-direction: column; align-items: stretch; gap: 4px; }
.intro-starts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.intro-starts .step-btn { min-height: 60px; padding: 8px 14px; text-align: center; line-height: 1.3; text-wrap: balance; text-decoration: none; }
.intro-starts a.step-btn { color: var(--primary-heavy); border: 2px solid var(--primary); background: var(--surface); }
.intro-actions #btn-intro-close { align-self: center; padding: 0 12px; }
@media (max-width: 420px) {
  .intro-starts { gap: 8px; }
  .intro-starts .step-btn { font-size: var(--t-label); padding: 8px 10px; }
  .intro-starts .step-btn .ic { display: none; }
}

/* ── 찾기 ──────────────────────────────────────────────────────────── */
.tool { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tool .ic { width: 1.2em; height: 1.2em; }
@media (max-width: 420px) {
  .tool { padding: 0 10px; }
}
.search {
  position: fixed; inset: 0; z-index: 30;
  display: flex; justify-content: center; align-items: flex-start;
  padding: max(5vh, env(safe-area-inset-top, 0px)) 16px 16px;
  background: var(--dim);
}
.search-box {
  width: min(640px, 100%); max-height: 100%;
  display: flex; flex-direction: column; min-height: 0;
  border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-raised);
  overflow: hidden;
}
.search-top { display: flex; gap: 8px; align-items: center; padding: 14px 14px 6px; }
.search-field {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px;
  min-height: 52px; padding: 0 12px; border: 2px solid var(--line-strong); border-radius: 12px; background: var(--surface);
}
.search-field:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
.search-field .ic { color: var(--ink-3); }
.search-field input {
  flex: 1 1 auto; min-width: 0; height: 48px; border: 0; outline: 0; background: none;
  font: inherit; font-size: var(--t-body); color: var(--ink);
}
.search-field input::placeholder { color: var(--ink-3); opacity: 1; }
.search-close {
  flex: 0 0 auto; min-height: 52px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--surface); font-size: var(--t-label); font-weight: 700; color: var(--ink-2); cursor: pointer;
}
.search-close:hover { background-image: linear-gradient(var(--hover), var(--hover)); }
.search-hint { margin: 0; padding: 0 16px 6px; font-size: var(--t-caption); color: var(--ink-3); }
.search-sum { padding: 0 16px 8px; font-size: var(--t-label); }
.search-sum p { margin: 0; }
.search-sum .cnt { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.search-sum .cnt b { color: var(--ink); }
.search-sum .g { font-size: var(--t-caption); font-weight: 600; color: var(--brass-text); }
.search-sum .more-t, .search-sum .none { color: var(--ink-3); font-size: var(--t-caption); }
.search-sum .none b { display: block; color: var(--ink); font-size: var(--t-label); }
.search-sum .sum-h { display: block; margin: 2px 0 6px; font-size: var(--t-caption); font-weight: 700; color: var(--ink-3); }
.search-sum .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sug {
  min-height: 40px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--surface); font-size: var(--t-label); font-weight: 600; color: var(--ink-2); cursor: pointer;
}
.sug:hover { background-image: linear-gradient(var(--hover), var(--hover)); }
.search-list {
  list-style: none; margin: 0; padding: 4px 14px 16px; display: grid; gap: 6px;
  overflow-y: auto; min-height: 0; overscroll-behavior: contain;
}
.search-list:empty { display: none; }
.sitem {
  width: 100%; text-align: left; display: grid; gap: 0; padding: 10px 12px;
  border: 1px solid var(--line); border-left: 5px solid var(--c); border-radius: 10px;
  background: var(--surface); cursor: pointer; font-size: var(--t-label); background-clip: padding-box;
}
.sitem:hover { background-image: linear-gradient(var(--hover), var(--hover)); }
.sitem:active { background-image: linear-gradient(var(--press), var(--press)); }
.sitem .s { color: var(--ink-3); font-size: var(--t-caption); }
.sitem .t { font-weight: 700; color: var(--ink); }
.sitem .r { color: var(--ink-2); font-size: var(--t-caption); }
.sitem .w { color: var(--brass-text); font-size: var(--t-caption); font-weight: 600; }
.sitem mark { background: #FFE9A8; color: inherit; border-radius: 3px; padding: 0 1px; }
.sitem .here { font-style: normal; margin-left: 4px; padding: 0 6px; border-radius: 6px; background: var(--primary); color: #fff; font-size: .8125rem; font-weight: 700; }
@media (max-width: 600px) {
  .search { padding: 0; }
  .search-box { width: 100%; height: 100%; border-radius: 0; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .search-top { padding: 10px 12px 6px; }
  .search-hint, .search-sum { padding-left: 14px; padding-right: 14px; }
  .search-list { padding: 4px 12px 16px; }
}

/* ── 화면 띄우기(?present): 빔프로젝터·TV용 ──────────────────────────── */
/* 지도는 왼쪽에 넓게, 오른쪽에 장면 제목·장절·글만 크게. 머리·이야기 줄·카드 단추·범례 대부분은 숨긴다 */
#btn-present .ic { width: 1.05em; height: 1.05em; }
:root[data-present], :root[data-present] body { overflow: hidden; }   /* 화면낭독기용 #live 줄이 아래로 밀려 생기는 세로 스크롤 막기 */
:root[data-present] body { background: #fff; }
:root[data-present] .app {
  height: 100%; min-height: 0;
  grid-template-columns: minmax(0, 1fr) clamp(380px, 34vw, 720px);
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: "map present";
}
:root[data-present] .masthead, :root[data-present] .stories, :root[data-present] .panel { display: none; }
:root[data-present] .map-wrap { height: 100%; }
.present { grid-area: present; }
:root[data-present] .present {
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
  padding: clamp(20px, 3.2vh, 48px) clamp(20px, 2.4vw, 48px) clamp(14px, 2vh, 28px);
  background: var(--surface); border-left: 6px solid var(--story, var(--primary));
}
.pr-eyebrow { margin: 0 0 .6em; font-size: clamp(1rem, 1.9vh, 1.5rem); font-weight: 700; color: var(--brass-text); line-height: 1.35; }
.pr-place { display: flex; flex-wrap: wrap; align-items: center; gap: .2em .5em; margin: 0 0 .3em; font-size: clamp(1.25rem, 2.6vh, 2.1rem); line-height: 1.3; }
.pr-place b { font-weight: 800; color: var(--ink); }
.pr-place .num {
  display: inline-grid; place-items: center; min-width: 1.6em; height: 1.6em; padding: 0 .3em; border-radius: 999px;
  background: var(--story, var(--primary)); color: #fff; font-weight: 800; font-size: .85em; font-variant-numeric: tabular-nums;
}
.pr-now-t { font-size: .7em; font-weight: 600; color: var(--now); }
.pr-title {
  margin: 0 0 .35em; font-family: var(--font-display); font-weight: 800; letter-spacing: -.01em;
  font-size: clamp(2rem, 5vh, 4.25rem); line-height: 1.2; color: var(--ink); text-wrap: balance;
}
.pr-ref { margin: 0 0 .8em; font-size: clamp(1.25rem, 2.7vh, 2.2rem); font-weight: 700; color: var(--primary-heavy); }
.pr-ref .when { margin-left: .5em; font-size: .8em; font-weight: 600; color: var(--brass-text); white-space: nowrap; }
.pr-text { margin: 0; font-size: clamp(1.25rem, 2.6vh, 2.1rem); line-height: 1.55; color: var(--ink-2); flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.pr-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 16px; margin-top: clamp(10px, 2vh, 24px); padding-top: clamp(10px, 1.6vh, 20px); border-top: 1px solid var(--line-soft); }
.pr-now .bar { height: 8px; border-radius: 4px; background: var(--line-soft); overflow: hidden; }
.pr-now .bar i { display: block; height: 100%; width: 0; background: var(--story, var(--primary)); border-radius: 4px; }
.pr-count { margin: 6px 0 0; font-size: clamp(1rem, 1.9vh, 1.5rem); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.pr-count b { color: var(--ink); }
.pr-btns { display: flex; gap: 6px; }
.pr-btn {
  min-width: 48px; min-height: 48px; padding: 0 10px; display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--radius-btn); background: var(--surface); color: var(--ink-2);
  font-size: var(--t-label); font-weight: 700; cursor: pointer;
}
.pr-btn:hover:not(:disabled) { background-image: linear-gradient(var(--hover), var(--hover)); }
.pr-btn:disabled { opacity: .45; cursor: default; }
.pr-help { grid-column: 1 / -1; margin: 0; font-size: .875rem; color: var(--ink-3); }
/* 지도: 범례는 실선·점선 한 줄만, 확대·축소와 축척은 숨긴다(출처 ⓘ는 라이선스 표시라 남김) */
:root[data-present] .key { font-size: clamp(.875rem, 1.6vh, 1.125rem); }
:root[data-present] .key-toggle, :root[data-present] .key .row + .row, :root[data-present] .key .row > span:nth-child(n+3) { display: none; }
:root[data-present] .key-body { display: flex !important; }
:root[data-present] .key.closed .key-body { display: flex !important; }
:root[data-present] .maplibregl-ctrl-top-left, :root[data-present] .maplibregl-ctrl-top-right { display: none; }
:root[data-present] .pin { font-size: 1.125rem; }
:root[data-present] .pin.current { font-size: 1.5rem; }
:root[data-present].idle, :root[data-present].idle * { cursor: none !important; }
/* 세로로 긴 화면(휴대폰·세로 TV): 지도 위, 글 아래 */
@media (max-aspect-ratio: 1/1) {
  :root[data-present] .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; grid-template-areas: "map" "present"; }
  :root[data-present] .present { border-left: 0; border-top: 6px solid var(--story, var(--primary)); max-height: 55svh; }
  .pr-title { font-size: clamp(1.5rem, 3.4vh, 3rem); }
  .pr-text { font-size: clamp(1.0625rem, 2vh, 1.75rem); }
}
@media (max-width: 600px) { .pr-help { display: none; } }
.blank { position: fixed; inset: 0; z-index: 40; background: #000; cursor: none; }

/* ── 거리 재기(내가 고른 곳 사이 직선거리) ──────────────────────────────── */
/* 이야기의 길(이야기 색·화살표)과 헷갈리지 않게: 지도 선은 검은 점선 + 흰 테두리(js), 거리 꼬리표는 흰 바탕 검은 테두리.
   켜는 동안 패널에는 거리 재기 상자만 보인다(장면 카드·아래 단추 줄은 숨김 → 카드 밀어 넘기기와 부딪히지 않음) */
.map-tools { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; clear: both; }
.map-tool {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px;
  border: 0; border-radius: 10px; background: var(--surface); color: var(--ink);
  box-shadow: 0 0 0 2px rgba(0,0,0,.1);
  font-size: .9375rem; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.map-tool .ic { width: 1.2em; height: 1.2em; stroke-width: 2; }
.map-tool:hover { background-image: linear-gradient(var(--hover), var(--hover)); }
.map-tool:active { background-image: linear-gradient(var(--press), var(--press)); }
/* maplibre-gl.css의 .maplibregl-ctrl button(투명 바탕, 마우스를 올리면 옅은 회색)보다 앞서게 .map-tools를 붙인다 */
.map-tools .map-tool { background-color: var(--surface); }
.map-tools .map-tool:not(:disabled):hover { background-color: var(--surface); background-image: linear-gradient(var(--hover), var(--hover)); }
.map-tools .map-tool[aria-pressed="true"], .map-tools .map-tool[aria-pressed="true"]:not(:disabled):hover { background-color: #111; background-image: none; color: #fff; box-shadow: 0 0 0 2px #fff, 0 1px 6px rgba(0,0,0,.3); }
@media (max-width: 500px) { .map-tool { padding: 0 10px; font-size: .875rem; } }
/* [도구] 하나: 켜진 도구(거리 재기·펜)가 있으면 검은 단추 + 노란 점 */
#btn-tools { position: relative; min-height: 44px; }
#btn-tools[aria-expanded="true"] { box-shadow: 0 0 0 2px var(--primary); }
.map-tools #btn-tools.has-on, .map-tools #btn-tools.has-on:not(:disabled):hover { background-color: #111; background-image: none; color: #fff; box-shadow: 0 0 0 2px #fff, 0 1px 6px rgba(0,0,0,.3); }
#btn-tools .on-dot { display: none; position: absolute; top: -4px; right: -4px; width: 14px; height: 14px; border-radius: 50%; background: #FFC400; border: 2px solid #fff; }
#btn-tools.has-on .on-dot { display: block; }

/* ── 작은 창: 지도 도구 서랍·장면 목록 ─────────────────────────────────── */
/* 휴대폰: 아래에서 올라오는 시트. 넓은 화면(.float): 연 단추 가까이 떠 있는 작은 창(js placePop) */
.pop {
  position: fixed; z-index: 25; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; max-height: min(80svh, 640px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface); border-radius: 20px 20px 0 0; box-shadow: 0 -10px 40px -10px rgba(20,38,74,.35);
}
.pop.float { left: auto; right: auto; width: min(420px, calc(100vw - 16px)); max-height: min(70vh, 620px); border-radius: var(--radius); box-shadow: var(--shadow-raised), 0 0 0 1px var(--line); }
.sheet-dim.for-pop { z-index: 24; }
.pop-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px 6px 18px; }
.pop-h { margin: 0; min-width: 0; font-size: var(--t-label); font-weight: 800; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pop-x {
  flex: 0 0 auto; min-height: 44px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-btn);
  background: var(--surface); font-size: var(--t-label); font-weight: 700; color: var(--ink-2); cursor: pointer;
}
.pop-x:hover { background-image: linear-gradient(var(--hover), var(--hover)); }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; padding: 4px 12px 14px; overflow-y: auto; }
.t-item {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 0 10px;
  min-height: 60px; padding: 8px 12px; text-align: left; text-decoration: none;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); background-clip: padding-box; cursor: pointer;
  font: inherit; color: var(--ink);
}
.t-item .ic { grid-row: 1 / span 2; width: 24px; height: 24px; stroke-width: 2; }
.t-item .ic.fill { width: 20px; height: 20px; margin: 0 2px; }
.t-name { font-size: var(--t-label); font-weight: 800; line-height: 1.3; }
.t-sub { font-size: .8125rem; color: var(--ink-3); line-height: 1.3; }
.t-item:hover { background-image: linear-gradient(var(--hover), var(--hover)); }
.t-item:active { background-image: linear-gradient(var(--press), var(--press)); }
.t-item[aria-pressed="true"] { border-color: #111; box-shadow: inset 0 0 0 1.5px #111; }
.t-item[aria-pressed="true"]::after { content: "켜짐"; position: absolute; top: 6px; right: 8px; padding: 0 6px; border-radius: 6px; background: #111; color: #fff; font-size: .75rem; font-weight: 700; line-height: 1.5; }
.steps-pop .step-list { padding-top: 0; }

.mtag {
  padding: 1px 7px; border-radius: 6px; background: #fff; border: 2px solid #111; color: #111;
  font-size: .875rem; font-weight: 800; line-height: 1.35; white-space: nowrap; pointer-events: none;
  font-variant-numeric: tabular-nums; box-shadow: 0 1px 4px rgba(0,0,0,.25); z-index: 6;
}
.mtag.sea { border-style: dashed; }
/* 고른 곳: 검은 고리(이야기의 번호 원·지금 장소 고리와 다른 모양) */
.pin.m-picked { z-index: 5 !important; }
.pin.m-picked .dot { box-shadow: 0 0 0 3px #fff, 0 0 0 6px #111 !important; animation: none !important; }   /* 지금 장소의 깜빡이는 고리보다 앞서게 */
.pin.m-picked .name { color: #111; font-weight: 800; }

.panel[data-measure] > :not(.measure) { display: none !important; }
.measure { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; padding-bottom: 20px; }
.m-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.m-h { display: flex; align-items: center; gap: 8px; margin: 0; font-size: var(--t-heading); font-weight: 800; color: var(--ink); }
.m-h:focus { outline: none; }
.m-h:focus-visible { outline: 3px solid var(--focus); }
.m-h .ic { width: 1.1em; height: 1.1em; stroke-width: 2.2; }
.m-end {
  min-height: 48px; padding: 0 18px; border-radius: var(--radius-btn); border: 1px solid #111;
  background: #111; color: #fff; font-size: var(--t-label); font-weight: 700; cursor: pointer;
}
.m-end:hover { background-image: linear-gradient(rgba(255,255,255,.12), rgba(255,255,255,.12)); }
.m-hint { margin: 0; font-size: var(--t-label); color: var(--ink-2); line-height: 1.5; }
.m-sum { padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 2px solid #111; }
.m-sum p { margin: 0; }
.m-total { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.m-total-h { flex: 1 1 100%; font-size: var(--t-label); font-weight: 700; color: var(--ink-3); }
.m-km { font-size: 2rem; font-weight: 800; color: #111; line-height: 1.2; font-variant-numeric: tabular-nums; }
.m-kind { font-size: var(--t-label); font-weight: 700; color: var(--ink-3); }
.m-walk { margin-top: 4px !important; font-size: var(--t-label); font-weight: 700; color: var(--ink-2); }
.m-real { margin-top: 2px !important; font-size: var(--t-caption); color: var(--ink-3); }
.m-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.m-list li { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; padding: 8px 0; position: relative; }
.m-list li + li { border-top: 1px dashed var(--line); }
.m-list .mn {
  display: grid; place-items: center; width: 28px; height: 28px; margin-top: 1px; border-radius: 8px;
  background: #111; color: #fff; font-size: .875rem; font-weight: 800; font-variant-numeric: tabular-nums;
}
.m-list .mt { display: grid; gap: 1px; min-width: 0; }
.m-list .mt > b { font-size: var(--t-body); color: var(--ink); }
.mm { font-size: var(--t-caption); color: var(--now); }
.m-list .mseg { font-size: var(--t-label); color: var(--ink-2); }
.m-list .mseg b { color: #111; }
.m-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.m-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 48px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-btn); background: var(--surface);
  font-size: var(--t-label); font-weight: 700; color: var(--ink-2); cursor: pointer;
}
.m-btn:hover:not(:disabled) { background-image: linear-gradient(var(--hover), var(--hover)); }
.m-btn:active:not(:disabled) { background-image: linear-gradient(var(--press), var(--press)); }
.m-btn:disabled { cursor: default; background: transparent; border: 1.5px dashed var(--line-strong); color: var(--ink-3); }
.m-find { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.m-find-l { font-size: var(--t-label); font-weight: 800; color: var(--ink); }
.m-find-f {
  display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 12px;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-btn); background: var(--surface);
}
.m-find-f:focus-within { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.m-find-f .ic { color: var(--ink-3); }
.m-find-f input { flex: 1 1 auto; min-width: 0; min-height: 44px; border: 0; outline: 0; background: none; font: inherit; font-size: var(--t-body); color: var(--ink); }
.m-q-hint { margin: 0; font-size: var(--t-caption); color: var(--ink-3); }
.m-res { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 6px; }
.m-res-h { grid-column: 1 / -1; font-size: var(--t-caption); font-weight: 700; color: var(--ink-3); }
.m-none { grid-column: 1 / -1; font-size: var(--t-label); color: var(--ink-3); }
.m-item {
  width: 100%; min-height: 48px; display: grid; gap: 0; align-content: center; text-align: left; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; font-size: var(--t-label);
}
.m-item b { color: var(--ink); }
.m-item .mm { font-size: .875rem; overflow-wrap: anywhere; }
.m-item:hover { background-image: linear-gradient(var(--hover), var(--hover)); }
.m-item:active { background-image: linear-gradient(var(--press), var(--press)); }
.m-item[aria-disabled="true"] { cursor: default; border-style: dashed; }
.m-picked-t { justify-self: start; margin-top: 2px; padding: 0 6px; border-radius: 6px; background: #111; color: #fff; font-size: .8125rem; font-weight: 700; }
.m-note { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line-soft); font-size: var(--t-caption); color: var(--ink-2); line-height: 1.55; }
.m-note b { color: var(--ink); }
:root[data-present] .measure, :root[data-present] .mtag { display: none !important; }

/* ── 강의 도구: 펜(지도에 그리기)·지도 저장 ──────────────────────────── */
/* 펜이 켜진 동안 #pen-pad가 지도(이름표·번호 포함)를 덮는다. 지도 단추(확대·거리 재기·펜)는 그 위에 남아 누를 수 있다 */
.pen-pad { position: absolute; inset: 0; z-index: 7; touch-action: none; cursor: crosshair; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
/* 지도 단추 묶음은 장소 번호(z-index 2–5)·묶음(4) 위에(MapLibre 기본값 2라 번호가 [거리 재기] 위로 올라오던 것) */
.maplibregl-ctrl-top-left, .maplibregl-ctrl-top-right { z-index: 6; }
.key { z-index: 6; }   /* 범례도 같은 높이(문서 순서상 단추 묶음보다 뒤라 겹치면 범례가 위) */
.map-wrap[data-pen] .maplibregl-ctrl-top-left, .map-wrap[data-pen] .maplibregl-ctrl-top-right { z-index: 8; }
.map-wrap[data-pen] .key { display: none; }   /* 범례 자리에 펜 도구 줄을 둔다(그리는 동안 범례는 잠깐 숨김) */
.pen-bar {
  position: absolute; z-index: 9; left: 50%; bottom: max(10px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px; max-width: calc(100% - 16px); padding: 6px;
  border-radius: 14px; background: var(--surface); box-shadow: 0 0 0 2px rgba(0,0,0,.12), 0 4px 16px rgba(0,0,0,.18);
}
.pen-colors { display: flex; gap: 4px; padding-right: 6px; margin-right: 2px; border-right: 1px solid var(--line); }
.pen-c {
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer;
  display: grid; place-items: center;
}
.pen-c::before { content: ""; width: 26px; height: 26px; border-radius: 50%; background: var(--pc); box-shadow: 0 0 0 1.5px rgba(0,0,0,.35) inset; }
.pen-c[aria-checked="true"]::before { width: 30px; height: 30px; box-shadow: 0 0 0 3px #fff, 0 0 0 5.5px #111; }
.pen-c:hover { background-image: linear-gradient(var(--hover), var(--hover)); }
.pen-b {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 44px; min-height: 44px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--ink-2);
  font-size: .9375rem; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.pen-b .ic { width: 1.15em; height: 1.15em; stroke-width: 2; }
.pen-b:hover:not(:disabled) { background-image: linear-gradient(var(--hover), var(--hover)); }
.pen-b:active:not(:disabled) { background-image: linear-gradient(var(--press), var(--press)); }
.pen-b:disabled { cursor: default; color: var(--ink-3); border-style: dashed; }
.pen-done { background: #111; border-color: #111; color: #fff; }
.pen-done:hover { background-image: linear-gradient(rgba(255,255,255,.12), rgba(255,255,255,.12)) !important; }
/* 좁은 지도: 되돌리기·지우기는 그림만(이름은 화면낭독기용 글로) */
@media (max-width: 520px) {
  .pen-b-t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .pen-b { padding: 0 8px; }
  .pen-bar { gap: 4px; padding: 5px; }
  .pen-colors { gap: 2px; padding-right: 4px; }
}
:root[data-present] .map-wrap[data-pen] .pen-bar { bottom: 16px; }
.map-tool[aria-busy="true"], .pr-btn[aria-busy="true"] { cursor: progress; opacity: .7; }
/* 띄우기 모드의 작은 단추 줄: [펜] [지도 저장] */
.pr-tools { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.pr-tool { display: inline-flex; gap: 6px; padding: 0 12px; }
.pr-tool .ic { width: 1.15em; height: 1.15em; stroke-width: 2; }
.pr-tool[aria-pressed="true"] { background: #111; border-color: #111; color: #fff; }


/* ── 2026-11-05 단순하게 개편: 휴대폰 확대·축소 단추, 처음 안내 두 모양, 가로 화면 ─────────── */
.tool-search { min-height: 52px; }
/* 휴대폰(세로 700px 미만, 또는 가로로 눕혀 높이 500px 이하)은 두 손가락으로 확대·축소 → +/− 단추를 숨긴다. 전체 보기 단추는 남김 */
@media (max-width: 699px), (orientation: landscape) and (max-height: 500px) {
  .maplibregl-ctrl-group.zoom-ctrl { display: none; }
}
/* 처음 안내(start): 한두 문장 + 시작 단추 두 개. [보는 법](help): 묶음 목록·자세한 보는 법·표기·출처 */
.intro[data-mode="start"] .m-help, .intro[data-mode="help"] .m-start { display: none !important; }
.intro[data-mode="start"] .intro-box { width: min(480px, 100%); }
.intro[data-mode="start"] .intro-lead { margin-bottom: 4px; }
.intro[data-mode="help"] .intro-actions { flex-direction: row; justify-content: center; }

/* 휴대폰을 가로로 눕히면(높이 500px 이하): iPad처럼 왼쪽에 정보(카드), 오른쪽에 큰 지도. 머리·아래 막대는 낮게, 카드만 스크롤 */
@media (orientation: landscape) and (max-height: 500px) {
  .app {
    height: 100%; min-height: 0;
    grid-template-columns: minmax(300px, 40%) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "head map" "panel map";
  }
  .map-wrap { position: relative; top: auto; height: 100%; box-shadow: none; }
  .panel { overflow-y: auto; gap: 10px; --panel-top: 10px; padding-top: var(--panel-top); }
  .masthead { padding-block: 6px; gap: 8px; flex-wrap: nowrap; }   /* 이야기 이름이 길어도 [찾기]가 둘째 줄로 내려가지 않게(이름은 … 줄임) */
  .menu-btn { flex: 1 1 0; }
  .brand-line { display: none; }   /* 휴대폰 가로(높이가 낮음): 지도 자리를 위해 이름 줄은 숨김(처음 안내·☰ 창에 이름이 있음) */
  .menu-btn { min-height: 46px; padding-block: 2px; }
  .menu-g { font-size: .75rem; }
  .tool-search { min-height: 46px; }
  .tool-search .tool-t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .tool-search { width: 46px; padding: 0; }
  .stepper { padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px)); gap: 6px; }
  .stepper .step-btn { min-height: 44px; min-width: 72px; padding: 0 10px; }
  .step-now { min-height: 44px; padding-block: 0; }
  .now-t .cnt { font-size: .8125rem; }
  .card { padding: 14px 16px 12px; }
  .card .card-mini { margin: 0 -16px; }
  .card h3 { font-size: 1.3125rem; }
  .story-head h2 { font-size: 1.25rem; }
  .resume { padding: 10px 12px; }
  .pop { max-height: 92svh; }
  .sheet { max-height: 88svh; }
  /* 2026-11-13 사용자 의견(카톡 안 브라우저 가로: "왼쪽은 거의 볼 수가 없어요"): 높이가 300px 안팎이면 머리와 아래 막대가
     왼쪽 칸의 절반을 먹는다. 아래 막대를 오른쪽 지도 밑에 띄워 왼쪽 칸은 머리 + 카드만 쓴다 */
  .stepper {
    position: fixed; left: max(300px, 40vw); right: 0; bottom: 0; z-index: 4;
    margin: 0; border-top: 0; box-shadow: 0 -6px 14px -10px rgba(20,38,74,.35);
  }
  .stepper .bar { margin-inline: 0; }
  .key { bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }
  .map-wrap .maplibregl-ctrl-bottom-right, .map-wrap .maplibregl-ctrl-bottom-left { bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }
  .panel { padding-bottom: 12px; }
}
