/* 휴대폰 공유 페이지의 여행 화면(머리, 경로 그림, 들른 곳, 공유할 이미지, 아래 고정 바)과 안내 화면. 390 폭 기준, 좌우 여백 20.
   글자 6단계: 28/800 제목, 22/700 구역 제목, 17/700 방문지 이름·버튼, 15 본문·시각, 13 라벨·안내, 12 칩·썸네일 표시 */
:root {
  --bg: #131417;
  --surface: #1D1E21;
  --rail: #313236;
  --line: #44464E;
  --text: #FFFFFF;
  --text-2: #C7C9CE;
  --text-3: #A4A8AE;
  --accent: #F5A623;
  --accent-pressed: #D98F14;
  --on-accent: #131417;
  --rain: #6FB8FF;
  --basic: rgba(255, 255, 255, 0.08);
  /* 선택 안 된 카드 종류 테두리. 바탕 #131417 과 대비 3.9:1 */
  --border-off: #6E7178;
  --gutter: 20px;
  /* 아래 고정 바 높이. main.js 가 실제 높이로 바꾼다 */
  --bar-h: 134px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  font-size: 15px;
  line-height: 22px;
  word-break: keep-all;
  /* 한 단어가 줄보다 길 때만 끊는다. anywhere 는 최소 폭 계산을 바꿔 숫자·링크가 한 글자씩 끊겼다 */
  overflow-wrap: break-word;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px var(--gutter) calc(var(--bar-h) + 16px);
}

[hidden] { display: none !important; }

h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; line-height: 36px; font-weight: 800; }
h2 { font-size: 22px; line-height: 30px; font-weight: 700; }
h3 { font-size: 17px; line-height: 24px; font-weight: 700; }

button { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, [tabindex="-1"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
h2[tabindex="-1"]:focus:not(:focus-visible) { outline: none; }

.brand { font-size: 15px; line-height: 22px; font-weight: 700; color: var(--accent); }

/* ── 안내 화면 (QR 없음, 깨진 주소, 버전 다름) ── */
.notice {
  min-height: calc(100vh - 48px);
  min-height: calc(100svh - 48px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 4px 140px;
}
.notice h1 { margin-top: 8px; }
.notice-body { margin-top: 12px; color: var(--text-2); }
.steps { list-style: none; margin: 28px 0 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.steps li { display: flex; align-items: center; gap: 12px; color: var(--text-2); }
.step-num {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  background: var(--rail); color: var(--text-2);
  font-size: 13px; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.notice .primary-button { margin-top: 28px; }

/* ── 머리 ── */
.head { display: flex; flex-direction: column; gap: 4px; }
.meta { color: var(--text-2); }

.stats {
  display: flex; flex-wrap: wrap; justify-content: space-between;
  gap: 8px 16px; margin: 16px 0 0;
}
.stat { display: flex; flex-direction: column-reverse; gap: 2px; }
.stat dd { margin: 0; white-space: nowrap; line-height: 30px; }
.stat dt { font-size: 13px; line-height: 18px; color: var(--text-3); white-space: nowrap; }
.stat .num { font-size: 24px; font-weight: 800; }
.stat .unit { font-size: 15px; font-weight: 600; }
.stat .unit:not(:last-child) { margin-right: 4px; }

/* ── 경로 그림 (패널 상자는 여기와 카드 미리보기에만) ── */
.route { margin-top: 24px; background: var(--surface); border-radius: 20px; overflow: hidden; }
.route canvas { display: block; width: 100%; height: 200px; }
.note { margin-top: 8px; font-size: 13px; line-height: 18px; color: var(--text-3); }

/* ── 들른 곳 ── */
.stops { margin-top: 28px; }
/* 좁은 폭(200% 확대)에서는 제목을 줄이지 않고 "사진 더 고르기"를 다음 줄로 보낸다 */
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 8px; min-height: 44px; }
.section-head h2 { flex: 1 0 auto; }
.text-button {
  flex: none; height: 44px; padding: 0 4px; border: 0; background: transparent;
  color: var(--text-2); font-size: 15px; cursor: pointer; white-space: nowrap;
}
.summary { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.summary:empty { display: none; }
.summary .main { color: var(--text-2); }
.summary .sub { font-size: 13px; line-height: 18px; color: var(--text-3); }

.timeline { list-style: none; margin: 16px 0 0; padding: 0; }
.row { display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 9px; }
.rail { display: flex; flex-direction: column; align-items: center; }
.rail-line { flex: 1; width: 2px; margin-top: 4px; background: var(--rail); }
.row:last-child .rail-line { display: none; }
.dot {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent);
  font-size: 13px; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.row-body { display: flex; flex-direction: column; padding-bottom: 24px; min-width: 0; }
.name-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-height: 28px; }
.chip {
  height: 22px; padding: 0 8px; border-radius: 11px;
  font-size: 12px; font-weight: 500; line-height: 22px; white-space: nowrap;
  background: var(--basic); color: var(--text-2);
}
.chip.rain { background: rgba(0, 130, 255, 0.18); color: var(--rain); }
.when { color: var(--text-2); }
.links { display: flex; flex-wrap: wrap; align-items: center; color: var(--text-2); }
.links a {
  display: inline-flex; align-items: center; min-height: 44px; white-space: nowrap;
  color: var(--text-2); text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: rgba(199, 201, 206, 0.4);
}
.links .sep { padding: 0 8px; color: var(--text-3); }

/* 잠깐 정차: 회색 작은 점 + 한 줄 */
.row.brief { min-height: 44px; }
.row.brief .rail { padding-top: 6px; }
.dot-brief { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--text-3); }
.brief-text { color: var(--text-3); padding-bottom: 16px; }

/* 이동 중 사진: 빈 점 + 점선 */
.row.moving .rail { padding-top: 6px; }
.dot-moving { flex: none; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--text-3); }
.row.moving .rail-line { width: 0; background: none; border-left: 2px dashed var(--line); }
.row.moving .row-body { gap: 8px; padding-bottom: 20px; }
.moving-title { color: var(--text-3); }

/* 썸네일 */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; margin-top: 4px; }
.thumbs:empty { display: none; }
.thumbs.small { display: flex; flex-wrap: wrap; margin-top: 0; }
.thumb {
  position: relative; display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 0; border-radius: 12px;
  background: #2B3036; overflow: hidden; cursor: pointer;
}
.thumbs.small .thumb { width: 64px; height: 64px; cursor: default; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb[aria-disabled="true"] { cursor: default; }
.thumb-chip {
  position: absolute; top: 6px; left: 6px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 700; line-height: 20px;
}
.thumb-band {
  position: absolute; left: 0; right: 0; bottom: 0; height: 22px;
  background: rgba(19, 20, 23, 0.8); color: var(--text); font-size: 12px; line-height: 22px; text-align: center;
  white-space: nowrap; overflow: hidden;
}

/* ── 공유할 이미지 ── */
.cards { margin-top: 36px; }
.kinds, .bg-photos {
  display: flex; align-items: flex-start; gap: 12px;
  margin: 12px calc(-1 * var(--gutter)) 0; padding: 4px var(--gutter);
  overflow-x: auto; scrollbar-width: none;
}
.kinds::-webkit-scrollbar, .bg-photos::-webkit-scrollbar { display: none; }
.kind {
  flex: none; width: 88px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 0; border: 0; background: transparent; color: var(--text-2);
  font-size: 13px; line-height: 18px; cursor: pointer; border-radius: 8px;
}
.kind[aria-pressed="true"] { color: var(--text); }
.kind-thumb {
  display: block; width: 88px; border: 2px solid var(--border-off); border-radius: 8px;
  overflow: hidden; background: var(--bg);
}
.kind[aria-pressed="true"] .kind-thumb { border-color: var(--accent); }
.kind-thumb-photo { height: 156px; background: #4A5560; }
.kind-thumb-tall { height: 156px; }
.kind-thumb-square { height: 88px; }
.kind-thumb-stops { height: 110px; }
.kind-svg { display: block; }

.card-hint { margin-top: 16px; color: var(--text-2); }
.card-hint:empty { display: none; }
.preview {
  display: flex; gap: 12px; margin: 16px calc(-1 * var(--gutter)) 0; padding: 0 var(--gutter);
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
}
.preview::-webkit-scrollbar { display: none; }
.preview:empty { display: none; }
.preview canvas { flex: none; width: min(240px, calc(100vw - 2 * var(--gutter))); height: auto; border-radius: 16px; background: var(--bg); scroll-snap-align: center; }
.preview canvas:only-child { margin: 0 auto; }
.preview-empty {
  display: flex; align-items: center; justify-content: center; width: 240px; max-width: 100%; aspect-ratio: 9 / 16;
  margin: 16px auto 0; padding: 24px; border: 2px dashed var(--line); border-radius: 16px;
  color: var(--text-2); text-align: center;
}
.bg-photos { gap: 8px; margin-top: 16px; }
.bg-photo {
  flex: none; position: relative; width: 64px; height: 64px; padding: 0; border: 2px solid transparent; border-radius: 10px;
  background: transparent; overflow: hidden; cursor: pointer;
}
.bg-photo img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 8px; }
.bg-photo[aria-pressed="true"] { border-color: var(--accent); }

.card-status { margin-top: 16px; color: var(--text-2); }
.card-status:empty { display: none; }
.downloads { list-style: none; margin: 4px 0 0; padding: 0; }
.downloads:empty { display: none; }
.downloads a {
  display: inline-flex; align-items: center; min-height: 44px; color: var(--text);
  text-decoration: underline; text-underline-offset: 3px;
}

.foot { margin-top: 32px; font-size: 13px; line-height: 18px; color: var(--text-3); text-align: center; }

/* ── 아래 고정 바 ── */
.bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; pointer-events: none; }
.bar::before {
  content: ""; display: block; height: 24px;
  background: linear-gradient(to bottom, rgba(19, 20, 23, 0), var(--bg));
}
.bar-body {
  pointer-events: auto; background: var(--bg);
  padding: 4px var(--gutter) calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px;
}
.bar-body > * { width: 100%; max-width: 520px; margin: 0 auto; }
.bar-hint { font-size: 13px; line-height: 18px; color: var(--text-3); text-align: center; }

.primary-button {
  display: block; width: 100%; min-height: 56px; padding: 8px 20px; border: 0; border-radius: 28px;
  background: var(--accent); color: var(--on-accent);
  font-size: 17px; font-weight: 700; line-height: 24px; cursor: pointer;
}

/* 눌림: 95% 축소 + 바탕색 변경 */
.primary-button:active { background: var(--accent-pressed); transform: scale(0.95); }
.text-button:active, .kind:active, .thumb:not([aria-disabled="true"]):active, .bg-photo:active { transform: scale(0.95); }
.text-button:active { background: var(--basic); border-radius: 8px; }
@media (prefers-reduced-motion: no-preference) {
  .primary-button, .text-button, .kind, .thumb, .bg-photo { transition: transform 80ms ease-out, background-color 80ms ease-out; }
}

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.noscript { padding: 48px 24px; color: var(--text-2); }
