/*
 * 골목지도 2.0 · 지도 중심 UI
 * 디자인 기준: 아티팩트 「골목지도 지도 중심 UI 시안」 (01 디자인 기초)
 *   글꼴 Noto Sans KR · 어스 브라운 · 모서리 칩 999 / 버튼 12 / 카드 14 / 시트 20 · 간격 4의 배수 · 누르는 곳 44px 이상
 * 1024px 이상은 PC(왼쪽 메뉴 76 + 패널 392 + 넓은 지도), 그보다 좁으면 휴대폰(지도 + 바텀시트 + 하단 탭 4개)
 */
:root {
  --primary: #79513D;
  --primary-dark: #5E3F2F;
  --action: #B8754C;
  --soft: #F2E6D9;
  --soft-line: #E6D3BF;
  --bg: #FBF7F1;
  --text: #302924;
  --sub: #6A5E55;
  --text-2: #4E443D;
  --neutral: #F3EEE7;
  --map: #F2EFE7;
  --line: #E8DFD3;
  --line-2: #D8CCBD;
  --dash: #A08F80;
  --white: #FFFFFF;
  --bus-trunk: #2E5BD8;
  --bus-branch: #2B8A3E;
  --bus-express: #C92A2A;
  --bus-village: #B35C00;
  --me: #2E5BD8;
  --shadow-float: 0 3px 10px rgba(48, 41, 36, 0.16);
  --shadow-card: 0 8px 28px rgba(48, 41, 36, 0.18);
  --font: 'Noto Sans KR', system-ui, sans-serif;
  --rail: 76px;
  --panel: 392px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--map); font-size: 15px; line-height: 22px; -webkit-font-smoothing: antialiased; overflow: hidden; }
a { color: var(--primary); }
a:hover { color: var(--primary-dark); }
button, input, textarea, select { font-family: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
img { max-width: 100%; display: block; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── 글자 크기 (디자인 기초 · 타이포그래피) ── */
.t-display { font-size: 28px; line-height: 36px; font-weight: 700; }
.t-title { font-size: 22px; line-height: 30px; font-weight: 700; }
.t-title-s { font-size: 20px; line-height: 28px; font-weight: 700; }
.t-sub { font-size: 17px; line-height: 24px; font-weight: 600; }
.t-body { font-size: 15px; line-height: 22px; }
.t-cap { font-size: 13px; line-height: 18px; color: var(--sub); }
.t-micro { font-size: 12px; line-height: 16px; color: var(--sub); }
.t-eyebrow { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--primary); }
.t-label { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--text-2); }
.t-strong-brown { color: var(--primary); font-weight: 600; }

/* ── 지도 ── */
#map { position: fixed; inset: 0; background: var(--map); }
.map-message { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; color: var(--sub); font-size: 14px; }

/* 지도 위 표시 (카카오 CustomOverlay 안에 들어감) */
.mk { display: flex; flex-direction: column; align-items: center; gap: 4px; transform: translateY(-14px); cursor: pointer; }
.mk-dot { width: 26px; height: 26px; border-radius: 50%; background: var(--white); border: 2px solid var(--primary); box-shadow: 0 2px 6px rgba(48, 41, 36, 0.25); }
.mk-label { padding: 2px 8px; border-radius: 999px; background: var(--white); font-size: 11px; line-height: 16px; font-weight: 600; box-shadow: 0 1px 4px rgba(48, 41, 36, 0.2); white-space: nowrap; color: var(--text); }
.mk.is-selected .mk-dot { width: 40px; height: 40px; background: var(--primary); border: 3px solid var(--white); display: flex; align-items: center; justify-content: center; box-shadow: 0 3px 10px rgba(48, 41, 36, 0.35); }
.mk.is-selected .mk-label { background: var(--text); color: var(--white); font-size: 12px; }
.mk-num { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: var(--white); border: 3px solid var(--white); box-shadow: 0 3px 8px rgba(48, 41, 36, 0.3); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }
.mk-stop { width: 26px; height: 26px; border-radius: 8px; background: var(--white); border: 2px solid var(--bus-trunk); box-shadow: 0 2px 6px rgba(48, 41, 36, 0.25); }
.mk.is-selected .mk-stop { width: 34px; height: 34px; background: var(--bus-trunk); border: 3px solid var(--white); }
.mk-event { width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: var(--white); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid var(--white); box-shadow: 0 2px 6px rgba(48, 41, 36, 0.3); }
.mk-photo { width: 40px; height: 40px; border-radius: 10px; border: 2px solid var(--white); box-shadow: 0 2px 6px rgba(48, 41, 36, 0.3); background: #CFE2EF center / cover no-repeat; }
.mk-me { width: 40px; height: 40px; border-radius: 50%; background: rgba(46, 91, 216, 0.16); display: flex; align-items: center; justify-content: center; }
.mk-me::after { content: ''; width: 16px; height: 16px; border-radius: 50%; background: var(--me); border: 3px solid var(--white); }
.mk-start { padding: 3px 10px; border-radius: 999px; background: var(--text); color: var(--white); font-size: 12px; font-weight: 600; white-space: nowrap; }
.mk-leg { padding: 2px 8px; border-radius: 999px; background: var(--white); font-size: 11px; font-weight: 700; box-shadow: 0 1px 4px rgba(48, 41, 36, 0.25); white-space: nowrap; }
.mk-density { border-radius: 50%; background: radial-gradient(circle, rgba(184, 117, 76, 0.55) 0%, rgba(184, 117, 76, 0.18) 55%, rgba(184, 117, 76, 0) 72%); pointer-events: none; }

/* ── 공통 부품 ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 12px; border: none; background: var(--neutral); color: var(--text); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.btn:hover { color: inherit; filter: brightness(0.97); }
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { color: var(--white); background: var(--primary-dark); filter: none; }
.btn-dark { background: var(--text); color: var(--white); }
.btn-dark:hover { color: var(--white); }
.btn-outline { background: var(--white); border: 1px solid var(--line-2); }
.btn-dashed { background: transparent; border: 1px dashed var(--dash); color: var(--text-2); }
.btn-block { width: 100%; }
.btn-lg { min-height: 50px; font-size: 15px; border-radius: 14px; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: none; background: var(--white); display: inline-flex; align-items: center; justify-content: center; flex: none; color: var(--text); text-decoration: none; }
.icon-btn.soft { background: var(--neutral); width: 36px; height: 36px; border-radius: 10px; }
.float { box-shadow: var(--shadow-float); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 2px 0 6px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--white); color: var(--text); font-size: 13px; font-weight: 500; text-decoration: none; }
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"], .chip.is-on { background: var(--text); color: var(--white); border-color: var(--text); font-weight: 600; }
.chip.soft[aria-pressed="true"], .chip.soft.is-on { background: var(--soft); color: var(--primary); border-color: var(--soft); }
.chip.brown[aria-pressed="true"], .chip.brown.is-on { background: var(--primary); color: var(--white); border-color: var(--primary); }
.chips.on-map .chip { border: none; box-shadow: 0 2px 8px rgba(48, 41, 36, 0.16); }
.tag { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; background: var(--neutral); color: var(--text-2); font-size: 11px; font-weight: 600; line-height: 16px; white-space: nowrap; }
.tag.soft { background: var(--soft); color: var(--primary); }
.tag.dashed { background: transparent; border: 1px dashed var(--dash); }
.bus { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; color: var(--white); font-size: 13px; font-weight: 700; white-space: nowrap; background: var(--bus-trunk); }
.bus.branch { background: var(--bus-branch); }
.bus.express { background: var(--bus-express); }
.bus.village { background: var(--bus-village); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--white); }
.seg a, .seg button { min-height: 40px; border-radius: 10px; border: none; background: transparent; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 500; color: var(--text-2); text-decoration: none; }
.seg [aria-current="page"], .seg [aria-pressed="true"] { background: var(--text); color: var(--white); font-weight: 600; }

.tabs-text { display: flex; gap: 20px; border-bottom: 1px solid var(--line); }
.tabs-text button { position: relative; min-height: 44px; padding: 0; border: none; background: none; font-size: 15px; color: var(--sub); }
.tabs-text button[aria-selected="true"] { color: var(--text); font-weight: 700; }
.tabs-text button[aria-selected="true"]::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--text); }

.card { border-radius: 14px; border: 1px solid var(--line); background: var(--white); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--text); }
.card:hover { color: var(--text); }
.card.is-on { border: 2px solid var(--primary); }
.card.soft { background: var(--soft); border-color: var(--soft); }
.note { padding: 12px 14px; border-radius: 12px; background: var(--neutral); color: var(--text-2); font-size: 13px; line-height: 19px; }
.notice { color: var(--sub); font-size: 13px; }
.empty { padding: 24px 0; text-align: center; color: var(--sub); font-size: 14px; }
.divider { height: 1px; background: var(--line); margin: 0; border: none; }
.thumb { flex: none; width: 64px; height: 64px; border-radius: 12px; background: var(--soft) center / cover no-repeat; display: flex; align-items: center; justify-content: center; color: var(--primary); }
.thumb.lg { width: 72px; height: 72px; }
.source { font-size: 12px; color: var(--sub); }

.place-row { display: flex; gap: 12px; align-items: center; padding: 8px 0; text-decoration: none; color: var(--text); min-height: 44px; }
.place-row:hover { color: var(--text); }
.place-row .name { font-size: 16px; line-height: 22px; font-weight: 700; }
.place-row .meta { font-size: 13px; line-height: 18px; color: var(--sub); }
.place-row .extra { font-size: 13px; line-height: 18px; color: var(--primary); font-weight: 500; }
.place-row.is-on { background: var(--soft); box-shadow: inset 4px 0 0 var(--primary); }
.panel .place-row { padding: 12px 16px; }

.field { display: flex; flex-direction: column; gap: 8px; }
.input { min-height: 44px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--neutral); font-size: 15px; color: var(--text); width: 100%; }
.input:focus, textarea.input:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
textarea.input { min-height: 150px; resize: vertical; background: var(--bg); line-height: 22px; border-radius: 14px; }
.search-box { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px; border-radius: 12px; background: var(--neutral); text-decoration: none; color: var(--sub); font-size: 15px; }
.search-box input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-size: 15px; color: var(--text); }
.search-box.is-active { border: 2px solid var(--primary); }
.search-box svg { flex: none; }
mark { background: none; color: var(--primary); font-weight: 700; }

.switch { width: 48px; height: 28px; border-radius: 999px; border: none; background: var(--line-2); position: relative; flex: none; padding: 0; }
.switch::after { content: ''; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--white); transition: transform .15s; }
.switch[aria-checked="true"] { background: var(--primary); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; min-height: 32px; }
.timeline .n { width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: var(--white); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.timeline .name { font-size: 15px; font-weight: 600; }
.timeline .time { font-size: 13px; color: var(--sub); }
.timeline .leg { grid-template-columns: 28px 1fr; min-height: 30px; }
.timeline .leg .bar { justify-self: center; width: 2px; height: 22px; background: #E2C7B0; }
.timeline .leg p { font-size: 12px; font-weight: 500; color: var(--primary); display: flex; gap: 6px; flex-wrap: wrap; }
.mode-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; color: var(--white); }

.legend { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 28px; height: 0; border-top: 5px solid; border-radius: 3px; }
.legend i.dash { border-top-style: dashed; }

.list-plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { padding: 12px; border-radius: 12px; background: var(--bg); text-align: center; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 20px; line-height: 28px; }
.stat span { font-size: 12px; color: var(--sub); }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 100; padding: 12px 18px; border-radius: 12px; background: var(--text); color: var(--white); font-size: 14px; box-shadow: var(--shadow-card); max-width: calc(100% - 32px); }

/* 후기 */
.review { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.review:last-child { border-bottom: none; }
.review .who { font-size: 13px; font-weight: 600; }
.review .body { font-size: 14px; line-height: 20px; color: var(--text-2); white-space: pre-wrap; word-break: break-word; }
.review .media { display: flex; gap: 6px; overflow-x: auto; }
.review .media img, .review .media video { width: 88px; height: 88px; border-radius: 12px; object-fit: cover; background: #CFE2EF; flex: none; }
.review .media video { width: 140px; }
.review .actions { display: flex; gap: 12px; }
.review .actions button { min-height: 32px; padding: 0; border: none; background: none; font-size: 12px; color: var(--sub); }

/* 사진 올리기 칸 */
.uploads { display: flex; gap: 8px; flex-wrap: wrap; }
.upload-add { width: 88px; height: 88px; border-radius: 12px; border: 1px dashed var(--action); background: var(--bg); color: var(--primary); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; font-weight: 600; cursor: pointer; }
.upload-item { position: relative; width: 88px; height: 88px; border-radius: 12px; overflow: hidden; background: #CFE2EF; }
.upload-item img, .upload-item video { width: 100%; height: 100%; object-fit: cover; }
.upload-item .kind { position: absolute; left: 6px; bottom: 6px; padding: 1px 6px; border-radius: 6px; background: rgba(48, 41, 36, 0.7); color: var(--white); font-size: 11px; }
.upload-item button { position: absolute; right: 4px; top: 4px; width: 28px; height: 28px; border-radius: 50%; border: none; background: rgba(48, 41, 36, 0.7); color: var(--white); font-size: 14px; }

/* ── 화면 틀 ── */
.app { position: fixed; inset: 0; pointer-events: none; }
.app > * { pointer-events: auto; }
.panel-body { display: flex; flex-direction: column; gap: 14px; }
.pad { padding: 0 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-s { display: flex; flex-direction: column; gap: 4px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

/* 장소 상세 (PC 떠 있는 카드 · 휴대폰 펼친 시트) */
.detail-hero { position: relative; height: 180px; background: #DCEBD3 center / cover no-repeat; display: flex; align-items: center; justify-content: center; color: #5E7A55; font-size: 12px; }
.detail-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.detail-actions .btn { flex-direction: column; min-height: 60px; font-size: 12px; gap: 4px; padding: 0 4px; }
.detail-actions .btn[aria-pressed="true"] { background: var(--soft); color: var(--primary); }

/* 바텀시트·패널에 들어가는 내용이 길면 그 안에서만 스크롤 */
.scroll-y { overflow-y: auto; overscroll-behavior: contain; }

/* 모달 (후기 쓰기) */
.modal-dim { position: fixed; inset: 0; z-index: 50; background: rgba(48, 41, 36, 0.48); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { width: 560px; max-width: 100%; max-height: calc(100vh - 32px); border-radius: 20px; background: var(--white); display: flex; flex-direction: column; overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px 12px 24px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 20px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--line); }

/* ─────────────── PC (1024px 이상) ─────────────── */
@media (min-width: 1024px) {
  .rail { position: fixed; left: 0; top: 0; bottom: 0; width: var(--rail); z-index: 20; background: var(--white); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 16px; }
  .rail .logo { width: 40px; height: 40px; border-radius: 12px; background: var(--primary); color: var(--white); font-size: 15px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; text-decoration: none; }
  .rail a.tab { width: 60px; height: 60px; border-radius: 12px; color: var(--text-2); text-decoration: none; font-size: 12px; font-weight: 500; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
  .rail a.tab[aria-current="page"] { background: var(--soft); color: var(--primary); font-weight: 700; }
  .bottom-tabs { display: none; }

  .panel { position: fixed; left: var(--rail); top: 0; bottom: 0; width: var(--panel); z-index: 15; background: var(--white); border-right: 1px solid var(--line); box-shadow: 4px 0 16px rgba(48, 41, 36, 0.06); display: flex; flex-direction: column; }
  .sheet-handle { display: none; }
  .panel-scroll { flex: 1; overflow-y: auto; }
  .panel-foot { padding: 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
  .panel-head { padding: 16px 16px 12px; display: flex; flex-direction: column; gap: 12px; border-bottom: 1px solid var(--line); }
  .panel-section { padding: 16px; display: flex; flex-direction: column; gap: 12px; }

  .detail { position: fixed; left: calc(var(--rail) + var(--panel) + 16px); top: 16px; bottom: 16px; width: 372px; z-index: 14; border-radius: 18px; background: var(--white); box-shadow: var(--shadow-card); display: flex; flex-direction: column; overflow: hidden; }
  .detail-close { position: absolute; right: 12px; top: 12px; }

  .map-top { position: fixed; right: 20px; top: 20px; z-index: 12; display: flex; gap: 8px; }
  .map-top .btn { min-height: 40px; font-size: 13px; background: var(--white); box-shadow: var(--shadow-float); }
  .map-top .btn.btn-dark { background: var(--text); }
  .map-top .btn[aria-pressed="true"] { background: var(--soft); color: var(--primary); outline: 2px solid var(--primary); }
  .map-tools { position: fixed; right: 20px; bottom: 24px; z-index: 12; display: flex; flex-direction: column; gap: 8px; }
  .map-search-top { display: none; }
  .layer-panel { position: fixed; right: 20px; top: 72px; width: 320px; z-index: 13; border-radius: 20px; background: var(--white); box-shadow: var(--shadow-card); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
  .map-badge { position: fixed; left: calc(var(--rail) + var(--panel) + 24px); bottom: 24px; z-index: 12; }
  body.has-detail .map-badge { left: calc(var(--rail) + var(--panel) + 404px); }
  .modal-dim.page-on-mobile { align-items: center; }
}

/* ─────────────── 휴대폰 (1024px 미만) ─────────────── */
@media (max-width: 1023.98px) {
  .rail { display: none; }
  .bottom-tabs { position: fixed; left: 0; right: 0; bottom: 0; height: 72px; z-index: 30; padding-bottom: max(10px, env(safe-area-inset-bottom)); background: var(--white); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .bottom-tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--sub); font-size: 11px; font-weight: 500; }
  .bottom-tabs a[aria-current="page"] { color: var(--primary); font-weight: 700; }

  .map-search-top { position: fixed; left: 16px; right: 16px; top: 16px; z-index: 12; display: flex; flex-direction: column; gap: 10px; }
  .map-search-top .search-box { height: 50px; border-radius: 14px; background: var(--white); box-shadow: 0 4px 14px rgba(48, 41, 36, 0.14); }
  .map-search-top .search-box.back { padding-left: 4px; }
  .map-top { display: none; }
  .map-tools { position: fixed; right: 16px; z-index: 12; display: flex; flex-direction: column; gap: 10px; bottom: calc(var(--sheet-h, 45vh) + 12px); transition: bottom .2s; }
  .map-tools .zoom { display: none; }
  .map-badge { position: fixed; left: 16px; z-index: 12; bottom: calc(var(--sheet-h, 45vh) + 12px); }

  /* 3단 바텀시트: 접힘 · 중간 · 펼침 */
  .panel { position: fixed; left: 0; right: 0; bottom: 72px; z-index: 20; height: var(--sheet-h, 45vh); background: var(--white); border-radius: 20px 20px 0 0; box-shadow: 0 -4px 20px rgba(48, 41, 36, 0.12); display: flex; flex-direction: column; transition: height .2s; touch-action: none; }
  .panel.is-dragging { transition: none; }
  .sheet-handle { flex: none; height: 24px; display: flex; align-items: center; justify-content: center; cursor: grab; border: none; background: none; width: 100%; }
  .sheet-handle::before { content: ''; width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); }
  .panel-scroll { flex: 1; overflow-y: auto; padding-bottom: 16px; touch-action: pan-y; }
  .panel-head { padding: 0 16px 12px; display: flex; flex-direction: column; gap: 12px; }
  .panel-section { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 12px; }
  .panel-foot { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
  .panel .place-row { padding: 6px 0; }
  .panel .place-row.is-on { background: transparent; box-shadow: none; }
  .panel-head .pc-only, .pc-only { display: none !important; }

  /* 전체 화면 페이지 (검색 · MY · 시간 맞춤 · 후기 쓰기): 시트를 화면 꼭대기까지 */
  body.page-mode .panel { top: 0; height: auto !important; border-radius: 0; box-shadow: none; background: var(--bg); }
  body.page-mode .panel .sheet-handle { display: none; }
  body.page-mode .map-search-top, body.page-mode .map-tools, body.page-mode .map-badge { display: none; }
  body.no-tabs .bottom-tabs { display: none; }
  body.no-tabs .panel { bottom: 0; }

  .detail { display: none !important; }
  .layer-panel { display: none !important; }
  .modal-dim { padding: 0; background: var(--white); align-items: stretch; }
  .modal { width: 100%; max-height: none; height: 100%; border-radius: 0; }
  .modal-head { padding: 6px 8px; height: 56px; }
  .modal-head .head-title { font-size: 17px; font-weight: 700; }
  .modal-foot { display: none; }
  .modal-body { padding: 16px; }
  .toast { bottom: calc(72px + 16px); }
}
@media (min-width: 1024px) { .mobile-only { display: none !important; } }

/* ── AI 어시스트 (디자인 AIHome · AIChat · AIError · PCAI) ── */
.ai-fab { position: fixed; z-index: 21; display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px 0 12px; border-radius: 999px; border: none; background: var(--primary); color: var(--white); box-shadow: 0 4px 14px rgba(48, 41, 36, 0.28); font-size: 14px; font-weight: 700; }
.ai-fab:hover { background: var(--primary-dark); }
body.page-mode .ai-fab, body.no-tabs .ai-fab, body.has-ai .ai-fab { display: none; }
.ai-badge { position: fixed; z-index: 12; display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--white); box-shadow: 0 2px 8px rgba(48, 41, 36, 0.14); font-size: 13px; font-weight: 600; transform: translateX(-50%); white-space: nowrap; }
body.page-mode .ai-badge { display: none; }
.ai-panel { position: fixed; z-index: 41; background: var(--white); display: flex; flex-direction: column; overflow: hidden; }
.ai-dim { position: fixed; inset: 0; z-index: 40; background: rgba(48, 41, 36, 0.42); }
.ai-grip { align-self: center; width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 10px 0 6px; flex: none; }
.ai-head { display: flex; justify-content: space-between; align-items: center; flex: none; }
.ai-avatar { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); display: flex; align-items: center; justify-content: center; }
.ai-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 14px; }
.ai-thread { display: flex; flex-direction: column; gap: 14px; flex: 1; }
.ai-me { align-self: flex-end; max-width: 78%; padding: 10px 14px; border-radius: 16px 16px 4px 16px; background: var(--primary); color: var(--white); font-size: 14px; line-height: 21px; white-space: pre-wrap; word-break: break-word; }
.ai-row { display: flex; gap: 8px; align-items: flex-start; }
.ai-bubble { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border-radius: 4px 16px 16px 16px; background: var(--neutral); font-size: 14px; line-height: 21px; }
.ai-text { white-space: pre-wrap; word-break: break-word; }
.ai-typing::after { content: '…'; display: inline-block; animation: ai-dots 1.2s steps(3, end) infinite; overflow: hidden; vertical-align: bottom; width: 1.2em; }
@keyframes ai-dots { from { width: 0; } to { width: 1.2em; } }
.ai-place { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--white); border: 1px solid var(--line); }
.ai-num { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: var(--white); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.ai-place-name { font-size: 14px; font-weight: 600; line-height: 20px; }
.ai-link { flex: none; min-height: 44px; padding: 0 4px; border: none; background: none; font-size: 12px; font-weight: 600; color: var(--primary); }
.ai-suggest { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--white); font-size: 14px; text-align: left; }
.ai-suggest:hover { background: var(--bg); }
.ai-foot { flex: none; display: flex; gap: 8px; align-items: center; border-top: 1px solid var(--line); background: var(--white); }
.ai-input { flex: 1; min-width: 0; height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg); font-size: 15px; }
.ai-input:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.ai-send { flex: none; width: 46px; height: 46px; border-radius: 12px; border: none; background: var(--primary); display: flex; align-items: center; justify-content: center; }
.ai-send:disabled, .ai-input:disabled { opacity: .6; }

@media (min-width: 1024px) {
  .ai-fab { right: 76px; bottom: 24px; }
  .ai-badge { bottom: 24px; left: calc((100vw + var(--rail) + var(--panel)) / 2); }
  body.has-ai .ai-badge { left: calc((100vw + var(--rail) + var(--panel) - 420px) / 2); }
  .ai-panel { right: 0; top: 0; bottom: 0; width: 420px; border-left: 1px solid var(--line); box-shadow: -4px 0 16px rgba(48, 41, 36, 0.08); }
  .ai-head { padding: 16px 8px 12px 20px; border-bottom: 1px solid var(--line); }
  .ai-body { padding: 16px 20px; }
  .ai-foot { padding: 14px 20px 20px; }
  body.has-ai .map-top, body.has-ai .map-tools { right: 440px; }
}
@media (max-width: 1023.98px) {
  .ai-fab { left: 16px; bottom: calc(72px + var(--sheet-h, 45vh) + 12px); }
  .ai-badge { top: 124px; left: 50%; }
  .ai-panel { left: 0; right: 0; top: 64px; bottom: 0; border-radius: 20px 20px 0 0; }
  .ai-head { padding: 0 4px 0 16px; }
  .ai-body { padding: 12px 16px; }
  .ai-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
}
