/* JIN TOUR — 서울 가을 파스텔 */
:root {
  --bg: #fbf6ee;
  --card: #ffffff;
  --ink: #3a302b;
  --muted: #8a7b72;
  --line: #efe4d6;
  --accent: #d9774b;        /* 감 */
  --accent-soft: #fbe6da;
  --leaf: #8fb39a;
  --walk: #3b7fd4;          /* 도보: 파랑 */
  --taxi: #f08a24;          /* 택시: 주황 */
  --exhibit: #b9a7e0;
  --food: #f2b38f;
  --cafe: #d8b98f;
  --shopping: #9ccbb5;
  --hotel: #a9c4e6;
  --bottom-h: 72px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Noto Sans CJK JP", "Yu Gothic", Meiryo, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  overflow-x: hidden;
  overflow-wrap: anywhere;
  -webkit-tap-highlight-color: transparent;
}
[lang="ko"] { font-family: "Apple SD Gothic Neo", "Noto Sans KR", "Noto Sans CJK KR", "Malgun Gothic", sans-serif; }
button, a.btn { font: inherit; color: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.35; margin: 0; }
[hidden] { display: none !important; }

.view {
  min-height: 100vh;
  padding: calc(12px + var(--safe-t)) 16px calc(var(--bottom-h) + var(--safe-b) + 24px);
  max-width: 640px;
  margin: 0 auto;
}
body.has-inapp .view { padding-top: calc(12px + var(--safe-t) + var(--inapp-h, 0px)); }

/* ---------- 상단 ---------- */
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand b { font-size: 1.5rem; letter-spacing: .06em; color: var(--accent); }
.brand span { color: var(--muted); font-size: .9rem; }
.trip-title { font-size: 1.35rem; margin-top: 2px; }
.trip-date { color: var(--muted); font-size: .95rem; }
.welcome { margin: 8px 0 12px; font-size: .95rem; }

.progress { background: var(--card); border-radius: 16px; padding: 12px 14px; margin: 8px 0 14px; box-shadow: 0 1px 3px rgb(80 50 30 / .06); }
.progress-row { display: flex; justify-content: space-between; gap: 8px; font-size: .9rem; }
.bar { height: 10px; background: var(--line); border-radius: 99px; margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--leaf), var(--accent)); border-radius: 99px; transition: width .3s; }
.now { margin-top: 6px; font-size: .88rem; color: var(--muted); }
.now b { color: var(--ink); }

/* ---------- 지도 ---------- */
.map-wrap { position: relative; border-radius: 18px; overflow: hidden; box-shadow: 0 2px 8px rgb(80 50 30 / .1); background: #eee; }
#map { height: 42vh; min-height: 240px; max-height: 420px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin: 6px 4px 0; }
.legend i { display: inline-block; width: 22px; height: 4px; border-radius: 2px; vertical-align: middle; margin-right: 4px; }
.pin {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: #fff; border: 3px solid var(--accent); color: var(--accent);
  font: 700 15px/1 sans-serif; box-shadow: 0 2px 6px rgb(0 0 0 / .25);
}
.pin.on { background: var(--accent); color: #fff; transform: scale(1.2); }
.pin.done { border-color: var(--leaf); color: var(--leaf); }
.pin.done.on { background: var(--leaf); color: #fff; }

/* ---------- 일정 카드 ---------- */
.section-title { font-size: 1.05rem; margin: 20px 4px 8px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.card {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center;
  width: 100%; text-align: left;
  background: var(--card); border: 2px solid transparent; border-radius: 18px;
  padding: 12px; box-shadow: 0 1px 3px rgb(80 50 30 / .07);
}
.card.current { border-color: var(--accent); background: #fffaf6; }
.card.done { opacity: .72; }
.num {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; color: #fff; background: var(--accent);
}
.card.done .num { background: var(--leaf); }
.card-body { min-width: 0; }
.card-time { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.card-name { font-size: 1.08rem; font-weight: 700; }
.card-ko { font-size: .85rem; color: var(--muted); }
.cat { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; padding: 1px 8px; border-radius: 99px; margin-left: 4px; color: var(--ink); vertical-align: 2px; }
.cat-exhibit { background: #efe9fa; } .cat-food { background: #fdeee4; } .cat-cafe { background: #f5ecdf; }
.cat-shopping { background: #e5f3ec; } .cat-hotel { background: #e6eef9; }
.chev { color: var(--muted); font-size: 1.3rem; }
.check {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line);
  display: grid; place-items: center; font-size: .75rem; color: #fff;
}
.card.done .check { background: var(--leaf); border-color: var(--leaf); }

.leg {
  display: flex; align-items: center; gap: 8px; width: calc(100% - 22px); margin: 0 0 0 22px;
  border: 0; border-left: 3px dashed var(--walk); background: transparent;
  padding: 10px 12px; text-align: left; font-size: .88rem; color: var(--muted);
}
.leg.taxi { border-left-color: var(--taxi); }
.leg .mode { font-weight: 700; color: var(--walk); }
.leg.taxi .mode { color: var(--taxi); }
.leg .go { margin-left: auto; color: var(--accent); white-space: nowrap; }

.credits { margin: 24px 4px 0; font-size: .75rem; color: var(--muted); line-height: 1.5; }
.credits summary { cursor: pointer; }
.credits ul { padding-left: 1.2em; margin: 6px 0; }
.credits a { color: inherit; }

/* ---------- 상세 ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.back { border: 0; background: var(--card); border-radius: 99px; padding: 8px 14px; box-shadow: 0 1px 3px rgb(80 50 30 / .08); }
.step { color: var(--muted); font-size: .9rem; }

.ph {
  position: relative; overflow: hidden; border-radius: 18px;
  aspect-ratio: 4 / 3; background: linear-gradient(135deg, var(--accent-soft), #f6efe3);
  display: grid; place-items: center; color: var(--muted); text-align: center;
}
.ph.cat-exhibit { background: linear-gradient(135deg, #ece4fb, #f7f2ff); }
.ph.cat-food { background: linear-gradient(135deg, #fde3d3, #fff3ea); }
.ph.cat-cafe { background: linear-gradient(135deg, #f1e2cc, #fbf5ec); }
.ph.cat-shopping { background: linear-gradient(135deg, #d8efe3, #f1faf5); }
.ph.cat-hotel { background: linear-gradient(135deg, #dbe7f7, #f2f7fd); }
.ph .ph-label { font-size: .85rem; padding: 8px; }
.ph .ph-icon { font-size: 2rem; display: block; }
.ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ph button { all: unset; position: absolute; inset: 0; cursor: zoom-in; }
.ph .credit {
  position: absolute; right: 0; bottom: 0; max-width: 100%;
  background: rgb(0 0 0 / .45); color: #fff; font-size: .62rem; line-height: 1.3;
  padding: 2px 6px; border-top-left-radius: 6px; pointer-events: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ph:not([data-ok]) .credit { display: none; }
.gallery .ph .credit, .route-photos .ph .credit { display: none; }
.hero { margin-bottom: 8px; }
.gallery {
  display: grid; grid-auto-flow: column; grid-auto-columns: 30%; gap: 8px;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
  padding-bottom: 4px; margin-bottom: 14px;
}
.gallery .ph { border-radius: 12px; scroll-snap-align: start; }
.gallery .ph .ph-icon { font-size: 1.2rem; }
.gallery .ph .ph-label { font-size: .7rem; padding: 4px; }

.place-name { font-size: 1.5rem; }
.place-ko { font-size: 1rem; color: var(--muted); margin-top: 2px; }
.place-sub { font-size: .88rem; color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.chip { background: var(--card); border-radius: 99px; padding: 4px 12px; font-size: .9rem; box-shadow: 0 1px 2px rgb(80 50 30 / .06); }
.lead { font-weight: 700; margin: 8px 0; }

.box { background: var(--card); border-radius: 18px; padding: 14px; margin: 12px 0; box-shadow: 0 1px 3px rgb(80 50 30 / .06); }
.box h2 { font-size: 1.05rem; margin-bottom: 6px; }
.box ul { margin: 0; padding-left: 1.2em; }
.box p { margin: 0; }

.player { display: grid; gap: 10px; }
.player-main { display: flex; gap: 8px; flex-wrap: wrap; }
.pbtn {
  flex: 1 1 auto; min-height: 52px; border: 0; border-radius: 14px; padding: 10px 14px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 1.02rem;
}
.pbtn.sub { flex: 0 0 auto; background: var(--accent-soft); color: var(--accent); }
.pbtn[disabled] { opacity: .5; }
.pstatus { font-size: .88rem; color: var(--muted); min-height: 1.4em; }
.pstatus.err { color: #b3402a; }
.pstatus:empty { display: none; }
.narration { line-height: 1.9; }
.narration .speaking { background: #fff1b8; border-radius: 4px; }

.addr { font-size: 1rem; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); text-decoration: none; font-size: .95rem; flex: 1 1 auto;
}
.btn.naver { background: #03c75a; color: #fff; border-color: #03c75a; font-weight: 700; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700; }
.btn.taxi { background: var(--taxi); color: #fff; border-color: var(--taxi); font-weight: 700; }

.arrive { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.arrive small { color: var(--muted); }

/* ---------- 이동 ---------- */
.route-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; text-align: center; }
.route-end { background: var(--card); border-radius: 14px; padding: 10px 6px; font-size: .9rem; font-weight: 700; }
.route-end small { display: block; color: var(--muted); font-weight: 400; }
.route-mode { font-size: 1.8rem; line-height: 1; text-align: center; }
.route-mode small { display: block; font-size: .8rem; font-weight: 700; }
.route-mode.walk small { color: var(--walk); } .route-mode.taxi small { color: var(--taxi); }
.facts { display: grid; gap: 4px; font-size: .95rem; }
.facts .note { font-size: .82rem; color: var(--muted); }
.route-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.route-photos .ph { border-radius: 12px; }

/* ---------- 하단 고정 이전/다음 ---------- */
.bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  padding: 8px 12px calc(8px + var(--safe-b));
  background: rgb(251 246 238 / .96); border-top: 1px solid var(--line);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.nav-btn {
  min-height: 56px; border-radius: 14px; border: 1px solid var(--line); background: var(--card);
  padding: 6px 10px; text-align: left; line-height: 1.3; min-width: 0;
}
.nav-btn.next { text-align: right; background: var(--accent); color: #fff; border-color: var(--accent); }
.nav-btn small { display: block; font-size: .75rem; opacity: .8; }
.nav-btn span { display: block; font-weight: 700; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-btn[disabled] { visibility: hidden; }

/* ---------- 오버레이 ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgb(20 14 10 / .92);
  display: grid; place-items: center; padding: 16px;
}
.lightbox figure { margin: 0; max-width: 100%; }
.lightbox img { max-height: 78vh; max-width: 100%; border-radius: 8px; margin: 0 auto; }
.lightbox figcaption { color: #fff; text-align: center; margin-top: 8px; white-space: pre-line; font-size: .9rem; }
.lb-close { position: absolute; top: calc(12px + var(--safe-t)); right: 12px; width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgb(255 255 255 / .15); color: #fff; font-size: 1.6rem; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; border: 0; border-radius: 10px; background: rgb(255 255 255 / .15); color: #fff; font-size: 2rem; }
.lb-prev { left: 8px; } .lb-next { right: 8px; }

.driver {
  position: fixed; inset: 0; z-index: 100; background: #fff; color: #111;
  display: flex; flex-direction: column; justify-content: center; gap: 16px;
  padding: calc(24px + var(--safe-t)) 20px calc(24px + var(--safe-b));
  text-align: center;
}
.driver .d-label { color: #666; font-size: 1rem; }
.driver .d-name { font-size: 2.2rem; font-weight: 800; line-height: 1.3; }
.driver .d-addr { font-size: 1.5rem; line-height: 1.4; }
.driver .d-msg { font-size: 1.25rem; color: #333; }
.driver button { align-self: center; min-height: 52px; padding: 10px 28px; border-radius: 14px; border: 0; background: var(--accent); color: #fff; font-weight: 700; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--bottom-h) + var(--safe-b) + 16px); transform: translateX(-50%);
  background: rgb(58 48 43 / .92); color: #fff; padding: 10px 18px; border-radius: 99px; font-size: .92rem;
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 120; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; }

.inapp {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  background: #fff4c7; color: #5a4300; font-size: .85rem; line-height: 1.5;
  padding: calc(8px + var(--safe-t)) 12px 8px; display: flex; gap: 8px; align-items: center;
}
.inapp p { margin: 0; flex: 1; }
.inapp button { border: 0; border-radius: 8px; padding: 6px 10px; background: #5a4300; color: #fff; white-space: nowrap; font-size: .82rem; }
.inapp .x { background: transparent; color: #5a4300; font-size: 1.1rem; padding: 4px 6px; }
