/* ─────────────────────────────────────────────
   여행 사이트 공통 디자인 (휴대폰 먼저)
   - 따뜻한 아이보리 바탕 + 짙은 녹색 버튼 + 차콜 글자
   - 노랑(주의)·빨강(위험)은 경고에만
   - 휴대폰 기준으로 만들고, 넓은 화면(900px 이상)은 맨 아래에서 따로 조정
   ───────────────────────────────────────────── */

/* 밝은 화면 색 */
:root {
  --bg: #f8f4ea;          /* 아이보리 바탕 */
  --card: #fffdf7;        /* 카드 */
  --text: #2b2d2c;        /* 차콜 글자 */
  --muted: #6a6a63;       /* 흐린 글자 */
  --line: #e5dece;        /* 테두리 */
  --accent: #1e5a3c;      /* 짙은 녹색 (주 버튼·선택) */
  --accent-text: #ffffff; /* 녹색 위 글자 */
  --accent-soft: #e5eee5; /* 연한 녹색 */
  --warn: #7f5200;        /* 주의 글자 */
  --warn-soft: #fbf0d2;   /* 주의 바탕 */
  --danger: #a3261c;      /* 위험 글자 */
  --danger-soft: #f8e2dd; /* 위험 바탕 */
  --shadow: 0 1px 2px rgba(60, 50, 30, .05), 0 6px 18px rgba(60, 50, 30, .05);
  --radius: 18px;
  color-scheme: light;
}

/* 어두운 화면 색 */
:root[data-theme="dark"] {
  --bg: #151916;
  --card: #1e2420;
  --text: #ece8de;
  --muted: #a9aca3;
  --line: #333b35;
  --accent: #79c595;
  --accent-text: #10251a;
  --accent-soft: #233a2b;
  --warn: #f3cd7a;
  --warn-soft: #3a3016;
  --danger: #ff9f92;
  --danger-soft: #45201b;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 120px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, "Noto Sans KR", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  word-break: keep-all;          /* 한국어 단어 중간에서 줄 안 바뀌게 */
  overflow-wrap: anywhere;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
a { color: var(--accent); }
h1, h2, h3, h4 { line-height: 1.3; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; font-weight: 800; }
h2 { font-size: 1.35rem; font-weight: 800; }
h3 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 16px 16px 96px; }

/* ── 맨 위 막대 ── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 6px;
  min-height: 56px; padding: 6px 12px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .home { font-weight: 800; text-decoration: none; color: var(--text); margin-right: auto; padding: 8px 4px; }
.topbar nav { display: flex; gap: 6px; align-items: center; }

/* ── 버튼 (손가락으로 누르기 쉽게 최소 44px) ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 16px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--text);
  font: inherit; font-size: 1rem; font-weight: 600; line-height: 1.2;
  text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.big { min-height: 56px; font-size: 1.15rem; font-weight: 700; border-radius: 14px; width: 100%; }
.btn.small { min-height: 40px; padding: 4px 12px; font-size: .93rem; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--danger); }
.btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}
.text-link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 18px;
}

/* 작은 디데이 표시 */
.dday-sm {
  display: inline-block; padding: 1px 10px; border-radius: 999px;
  border: 1px solid var(--accent); color: var(--accent);
  font-size: .85rem; font-weight: 700; line-height: 1.6; vertical-align: 2px; white-space: nowrap;
}

/* 입력 칸 공통 */
input[type="text"], input[type="number"], input[type="time"], select, textarea {
  font: inherit; font-size: 1rem; min-height: 44px; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text);
}
textarea { line-height: 1.5; resize: vertical; }

/* ═════════════ 홈 ═════════════ */
.home-list { display: flex; flex-direction: column; gap: 18px; max-width: 560px; margin: 8px auto 0; }
.trip-hero { display: flex; flex-direction: column; gap: 14px; padding: 26px 22px 22px; }
.trip-hero .eyebrow { font-size: .9rem; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.trip-hero h1 { font-size: 2.6rem; line-height: 1.1; }
.trip-hero .dates { font-size: 1.15rem; font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.trip-hero .sub { color: var(--muted); font-size: .98rem; }
.trip-hero .actions { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 6px; }

/* ═════════════ 여행 정보 (정보지) ═════════════ */
.guide-hero { display: flex; flex-direction: column; gap: 14px; }
.guide-hero .dates { font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }

/* 핵심 일정 요약: 날짜 칸을 따로 둬서 1/4 밤과 1/5 새벽이 구분되게 */
.timeline { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.timeline li { display: grid; grid-template-columns: 104px 1fr; border-top: 1px solid var(--line); }
.timeline li:first-child { border-top: 0; }
.timeline .d { padding: 12px 12px; background: var(--accent-soft); font-weight: 800; line-height: 1.35; }
.timeline .c { padding: 12px 14px; line-height: 1.45; }
.timeline .t { display: block; font-weight: 800; font-size: 1.1rem; }
.timeline li.strong .d { background: var(--accent); color: var(--accent-text); }

.intro { margin: 0; padding-left: 1.2em; color: var(--muted); font-size: .97rem; }
.intro li + li { margin-top: 2px; }

.sections { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.section > * + * { margin-top: 14px; }
.section h2 { display: flex; gap: 10px; align-items: baseline; }
.section h2 .num { color: var(--accent); font-variant-numeric: tabular-nums; }
.section h3 { margin-top: 20px; }

/* 표: 좁은 화면에서는 표 안에서만 옆으로 밀어서 보기 */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; min-width: 520px; font-size: .97rem; }
.table-wrap.narrow table { min-width: 0; }
th, td { padding: 11px 13px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { background: var(--accent-soft); font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td:first-child { font-weight: 700; }

/* 색깔 상자: 이모지 대신 왼쪽 색 막대 */
.note { padding: 13px 16px; border-radius: 12px; border-left: 5px solid var(--accent); background: var(--accent-soft); }
.note.warn   { background: var(--warn-soft); color: var(--warn); border-left-color: var(--warn); }
.note.danger { background: var(--danger-soft); color: var(--danger); border-left-color: var(--danger); font-weight: 600; }

.detail { background: var(--bg); border-radius: 12px; padding: 14px 16px; }
.detail h3 { margin: 0 0 6px; }
.detail ul, ul.list { margin: 0; padding-left: 1.25em; }
.detail li + li, ul.list li + li { margin-top: 4px; }

/* 체크리스트 */
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.checklist label {
  display: flex; gap: 14px; align-items: center; min-height: 52px;
  padding: 10px 14px; border-radius: 12px; background: var(--bg); cursor: pointer;
}
.checklist input { width: 24px; height: 24px; accent-color: var(--accent); flex: none; }
.checklist input:checked + span { color: var(--muted); text-decoration: line-through; }
.check-count { font-weight: 700; color: var(--accent); }

/* ── 사진 ── */
.photo-area { display: flex; flex-direction: column; gap: 12px; }
.photo-bar { display: flex; justify-content: flex-end; }
.photos { display: flex; flex-direction: column; gap: 12px; }
.photo { margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); }
/* 글자 있는 지도·인포그래픽이 잘리지 않게: 본문 너비에 맞춰 줄이기만 함 */
.photo img { display: block; width: 100%; max-width: 100%; height: auto; object-fit: contain; background: #fff; }
.photo figcaption { padding: 8px 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .95rem; color: var(--muted); }
.photo figcaption .cap { flex: 1 1 200px; }
.photo .tools { display: flex; gap: 6px; flex-wrap: wrap; }
.photo input.cap-edit { flex: 1 1 220px; border-color: var(--accent); }

.dropzone {
  border: 2px dashed var(--line); border-radius: 12px;
  padding: 16px; text-align: center; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.dropzone.over, .photo.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.dropzone .drag-text { font-size: .95rem; }
.dropzone.busy { opacity: .6; pointer-events: none; }
@media (hover: none) { .dropzone .drag-text { display: none; } }   /* 휴대폰은 "사진 선택" 버튼만 */

/* "사진 관리"를 열기 전에는 올리기 칸·편집 버튼 숨김 */
.section:not(.managing) .photo .tools,
.section:not(.managing) .dropzone { display: none; }
.section:not(.managing) .place-card:not(:has(.photo)) { display: none; }
.section:not(.managing) .places-block:not(:has(.photo)) { display: none; }
.section:not(.managing) .manage-hint { display: none; }

.place-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 12px; }
.place-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.place-card h4 { font-size: 1.02rem; }
.place-card .meta { font-size: .9rem; color: var(--muted); line-height: 1.45; }

/* ═════════════ 일정 ═════════════ */
.plan-top { display: flex; flex-direction: column; gap: 8px; }
.plan-top h1 { font-size: 1.6rem; }
.plan-top .dates { color: var(--muted); font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* 전체 비용 작은 요약 (누르면 비용 상세) */
.cost-summary {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%;
  min-height: 48px; padding: 8px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  font: inherit; font-size: .95rem; cursor: pointer; text-align: left;
}
.cost-summary b { color: var(--accent); }
.cost-summary .arrow { color: var(--muted); transition: transform .15s; }
.cost-summary[aria-expanded="true"] .arrow { transform: rotate(90deg); }
.cost-detail { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.cost-detail table { min-width: 0; }
.cost-detail td, .cost-detail th { padding: 8px 10px; }
.cost-detail td:not(:first-child), .cost-detail th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.rate-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rate-row input { width: 110px; }
.save-state { font-size: .9rem; color: var(--muted); min-height: 1.4em; }

/* 날짜 선택 줄 */
.date-tabs {
  position: sticky; top: 56px; z-index: 40;
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px;
  margin: 12px -16px 0; padding: 8px 12px;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.date-tabs button {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 56px; padding: 4px 0; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  font: inherit; font-size: 1rem; font-weight: 500; line-height: 1.2; cursor: pointer;
}
.date-tabs button small { font-size: .78rem; color: var(--muted); }
.date-tabs button .cnt { font-size: .72rem; color: var(--muted); }
.date-tabs button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 800; }
.date-tabs button[aria-selected="true"] small,
.date-tabs button[aria-selected="true"] .cnt { color: var(--accent-text); }

.plan-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 14px; }
.palette { display: none; }       /* 휴대폰에서는 카드 목록 대신 "장소 추가" 창 사용 */

.days { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.day { display: flex; flex-direction: column; gap: 12px; padding: 18px 16px; }
.day:not(.selected) { display: none; } /* 휴대폰: 고른 날짜만 */
.day-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.day-head h2 { font-size: 1.4rem; }
.day-sum { color: var(--muted); font-size: .92rem; text-align: right; }
.day-sum b { color: var(--text); }
.day-warn { display: flex; flex-direction: column; gap: 6px; }
.day-warn:empty { display: none; }
.day-warn .note { padding: 10px 14px; font-size: .95rem; }

.day-list { display: flex; flex-direction: column; gap: 10px; border-radius: 12px; }
.empty { text-align: center; color: var(--muted); padding: 22px 8px 6px; font-size: 1.02rem; }
.add-btn { width: 100%; }

.item { border: 1px solid var(--line); border-radius: 14px; background: var(--bg); padding: 12px 12px 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.item.bad { border-color: var(--danger); box-shadow: 0 0 0 2px var(--danger-soft); }
.item.caution { border-color: var(--warn); }
.item-main { display: flex; gap: 8px; align-items: flex-start; }
.item-main .handle { display: none; cursor: grab; font-size: 1.3rem; color: var(--muted); padding: 2px 4px 0 0; touch-action: none; user-select: none; }
.item-text { flex: 1; min-width: 0; }
.item-title { font-size: 1.12rem; font-weight: 800; line-height: 1.35; }
.item-meta { color: var(--muted); font-size: .94rem; margin-top: 2px; line-height: 1.45; }
.item-meta .time { color: var(--text); font-weight: 700; }
.item-memo { margin-top: 4px; font-size: .95rem; white-space: pre-wrap; }
.item-edit { flex: none; }
.item-form { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; }
.item-form label { font-size: .9rem; color: var(--muted); }
.item-form .full { grid-column: 1 / -1; }
.item-form input[type="time"] { width: 100%; }
.item-form input, .item-form select { width: 100%; min-width: 0; }
.item-form textarea { width: 100%; min-height: 64px; }
.item-form .row-end { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.flags:empty { display: none; }
.flag { font-size: .92rem; font-weight: 600; }
.flag.danger { color: var(--danger); }
.flag.warn { color: var(--warn); }
.flag.info { color: var(--accent); }

.kind { font-size: .82rem; font-weight: 700; color: var(--accent); }

/* ── 장소 추가 창 (아래에서 올라옴) ── */
.sheet { position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; justify-content: flex-end; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(20, 18, 12, .45); }
.sheet-panel {
  position: relative; background: var(--card); border-radius: 20px 20px 0 0;
  max-height: 86vh; display: flex; flex-direction: column;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .15);
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sheet-head h2 { font-size: 1.2rem; }
.sheet-head .for { color: var(--accent); }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 12px 0 10px; }
.cand-list { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
.cand { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 14px; padding: 10px 10px 10px 14px; background: var(--bg); }
.cand .info { flex: 1; min-width: 0; line-height: 1.4; }
.cand .t { font-weight: 800; }
.cand .s { font-size: .88rem; color: var(--muted); }
.cand .btn { flex: none; }
.cand.added .btn { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

/* 카드 목록 (넓은 화면 전용) */
.pcard {
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
  padding: 10px 12px; display: flex; gap: 10px; align-items: center; cursor: grab;
}
.pcard .thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; flex: none; background: var(--accent-soft); }
.pcard .info { flex: 1; min-width: 0; line-height: 1.4; }
.pcard .t { font-weight: 700; }
.pcard .s { font-size: .86rem; color: var(--muted); }

.sortable-ghost { opacity: .35; }
.sortable-chosen { box-shadow: 0 6px 20px rgba(0, 0, 0, .18); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 12px 20px; border-radius: 12px;
  font-weight: 600; z-index: 100; max-width: 90vw; text-align: center;
}

/* ═════════════ 넓은 화면 (컴퓨터) ═════════════ */
@media (min-width: 900px) {
  .wrap { padding: 24px 24px 96px; }
  h1 { font-size: 2rem; }
  .card { padding: 24px; }

  /* 여행 정보: 왼쪽에 전체 목차 항상 보이기 */

  /* 일정: 카드 목록 + 날짜 칸 전부 + 끌어다 놓기 */
  .date-tabs { display: none; }
  .plan-top { flex-direction: row; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; }
  .cost-summary { width: auto; min-width: 320px; }
  .plan-layout { grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
  .palette { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 76px; max-height: calc(100vh - 96px); padding: 16px; }
  .palette .tabs { margin: 0; }
  .palette-list { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 2px; }
  .days { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
  .day, .day:not(.selected) { display: flex; }
  .day-list { min-height: 72px; }
  .day-list:empty { border: 2px dashed var(--line); }
  .day .empty { display: none; }
  .item-main .handle { display: block; }
}

/* ═════════════ 추가: 공항 고정 일정 · 지우기 확인창 · 음식 단계 · 목적별 묶음 · 장소 상세 ═════════════ */

.sandbox-bar { background: var(--warn-soft); color: var(--warn); text-align: center; font-weight: 700; font-size: .9rem; padding: 6px 12px; }
.local-time { font-size: .88rem; color: var(--muted); margin-top: 2px; }

/* 공항 고정 일정: 일반 일정과 같은 줄에 놓되, 테두리 점선 + 회색 바탕으로 구분 (끌기·수정 불가) */
.fixed-top:empty, .fixed-bottom:empty { display: none; }
.fixed-top, .fixed-bottom { display: flex; flex-direction: column; gap: 10px; }
.fixed {
  display: grid; grid-template-columns: 92px 1fr; gap: 10px; align-items: start;
  border: 1.5px dashed var(--accent); border-radius: 14px; padding: 12px 12px 12px 14px;
  background: var(--accent-soft);
}
.fixed-time { font-weight: 800; font-size: 1.1rem; line-height: 1.3; font-variant-numeric: tabular-nums; }
.fixed-title { font-weight: 800; line-height: 1.35; margin-top: 4px; }
.fixed-sub { font-size: .9rem; color: var(--muted); margin-top: 2px; }
.tag { display: inline-block; font-size: .78rem; font-weight: 800; padding: 1px 9px; border-radius: 999px; line-height: 1.6; }
.tag-flight { background: var(--accent); color: var(--accent-text); }
.tag-leave  { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn); }
.tag-goal   { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger); }
.next-day { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.next-day-label {
  display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--accent); font-size: .98rem;
}
.next-day-label::before, .next-day-label::after { content: ""; flex: 1; border-top: 2px solid var(--accent); opacity: .5; }

/* 일정 카드: 옆으로 밀어 지우기 (위아래 스크롤은 그대로 되고, 옆 움직임만 사이트가 받음) */
.item-main { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; cursor: pointer; touch-action: pan-y; }
.item.swipe-ready { border-color: var(--danger); background: var(--danger-soft); }

/* "되돌리기" 알림 */
.toast.undo { display: flex; align-items: center; gap: 14px; text-align: left; width: max-content; }
.toast.undo button {
  background: none; border: 0; color: var(--accent-soft, #9fd3b4); font: inherit; font-weight: 800;
  padding: 4px 2px; cursor: pointer; white-space: nowrap;
}

/* 컴퓨터: 일정을 끄는 동안 카드 목록에 "여기에 놓으면 일정에서 빼기" 표시 */
.palette { position: relative; }
.palette.drop-remove { outline: 2px dashed var(--danger); outline-offset: -6px; }
.palette.drop-remove::after {
  content: "여기에 놓으면 일정에서 빼기"; position: absolute; left: 12px; right: 12px; top: 12px;
  background: var(--danger); color: #fff; font-weight: 800; text-align: center; padding: 10px; border-radius: 10px;
  pointer-events: none;
}
.palette.drop-remove .palette-list > .item { display: none; }
.no-cost { color: var(--warn); font-weight: 600; }

/* 지우기 확인창 (화면 가운데) */
.sheet.confirm { justify-content: center; align-items: center; padding: 20px; z-index: 95; }
.confirm-panel {
  position: relative; background: var(--card); border-radius: 18px; width: 100%; max-width: 380px;
  padding: 22px 20px 18px; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); display: flex; flex-direction: column; gap: 6px;
}
.confirm-panel h2 { font-size: 1.2rem; }
.confirm-name { font-size: 1.1rem; font-weight: 800; margin-top: 6px; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.btn.danger-fill { background: var(--danger); border-color: var(--danger); color: #fff; }
:root[data-theme="dark"] .btn.danger-fill { color: #2a0d09; }

/* 장소 추가 창: 정보 / 담기 버튼, 음식 단계 */
.cand .btn + .btn { margin-left: -2px; }
.btn.done { background: var(--accent-soft) !important; color: var(--accent) !important; border-color: var(--accent) !important; }
.cat-row { width: 100%; font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.cat-row .info { display: flex; flex-direction: column; }
.cat-row .go, .place-links .go { color: var(--muted); font-size: 1.4rem; flex: none; }
.sheet-hint { color: var(--muted); font-size: .93rem; margin-bottom: 2px; }
.sheet-box { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 6px; display: flex; flex-direction: column; gap: 8px; }
.sheet-box h3 { font-size: 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 40px; padding: 4px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font: inherit; font-size: .95rem; cursor: pointer;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 800; }
.add-wide { width: 100%; justify-content: flex-start; }
.back-btn { align-self: flex-start; padding-left: 4px; }
.cat-title { font-size: 1.25rem; }
.ref { font-size: .88rem; color: var(--muted); }
.typed-row { display: flex; gap: 8px; }
.typed-row input { flex: 1; min-width: 0; }
.item-form .ref { grid-column: 1 / -1; margin: 0; }
.item-form input[type="text"] { width: 100%; }

/* 여행 정보: 목적별 묶음 */
.groups { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 14px; }
.group { padding: 16px; display: flex; flex-direction: column; gap: 10px; scroll-margin-top: 120px; }
.group h2 { font-size: 1.2rem; }
.g-links { display: flex; flex-wrap: wrap; gap: 6px; }
.g-link {
  display: inline-flex; align-items: center; min-height: 40px; padding: 4px 12px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: .93rem; font-weight: 600;
}
.g-link:hover { border-color: var(--accent); }
.g-food { color: var(--muted); font-size: .95rem; }
.place-links { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.place-links li + li { border-top: 1px solid var(--line); }
.place-links a { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 12px; color: var(--text); text-decoration: none; }
.place-links a:hover { background: var(--accent-soft); }
.pl-t { font-weight: 700; flex: 1; min-width: 0; line-height: 1.35; }
.pl-s { color: var(--muted); font-size: .85rem; text-align: right; max-width: 45%; line-height: 1.35; }
.place-card h4 a { color: var(--text); }

/* 장소 상세 */
.place-wrap { max-width: 760px; }
.place-detail { display: flex; flex-direction: column; gap: 16px; }
.pd-head { display: flex; flex-direction: column; gap: 4px; }
.pd-kind { font-size: .85rem; font-weight: 800; color: var(--accent); }
.pd-head h1 { font-size: 1.9rem; }
.pd-region { color: var(--muted); font-weight: 600; }
.pd-intro { font-size: 1.1rem; font-weight: 600; line-height: 1.6; }
.pd-sec { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.pd-sec h2 { font-size: 1.1rem; }
.pd-big { font-size: 1.15rem; font-weight: 800; }
.pd-sec .btn { align-self: flex-start; }
.pd-foot { font-size: .88rem; }

@media (min-width: 900px) {
  .groups { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ═════════════ 동선 지도 ═════════════ */
.map-card { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.map-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.map-head h2 { font-size: 1.15rem; }
.map-days { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; width: 100%; }
.map-days .btn { padding: 6px 0; min-height: 0; font-size: .85rem; }
.map-days button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.day-map { height: 280px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); z-index: 0; }
.map-note { font-size: .86rem; color: var(--muted); }
[data-theme="dark"] .day-map .leaflet-tile-pane { filter: brightness(.75) invert(1) contrast(.9) hue-rotate(180deg) saturate(.6); }
.leaflet-container { font-family: inherit; }

/* 번호 핀 */
.map-pin span {
  display: flex; align-items: center; justify-content: center; height: 28px; padding: 0 6px;
  background: var(--accent); color: var(--accent-text); border: 2px solid #fff; border-radius: 14px;
  font-weight: 800; font-size: .85rem; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); white-space: nowrap;
}
/* 구간 화살표 */
.map-arrow span {
  display: block; width: 22px; height: 22px; line-height: 22px; text-align: center;
  color: var(--accent); font-size: 18px; text-shadow: 0 0 3px #fff, 0 0 3px #fff;
}

@media (min-width: 900px) {
  .add-btn { display: none; }          /* 컴퓨터는 카드 목록에서 끌어다 놓기로 추가 → "장소 추가" 버튼 없음 */
  .day-map { height: 380px; }
}

/* 여행 중 빠르게 확인하는 장소 정보 */
.pd-map { align-self: flex-start; min-height: 44px; }
.pd-facts { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 8px; }
.pd-facts > div { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.pd-facts dt { color: var(--muted); font-size: .85rem; font-weight: 700; }
.pd-facts dd { margin: 2px 0 0; line-height: 1.45; }
.pd-photo img { max-height: 440px; }
.pd-sec .list li + li { margin-top: 10px; }
.guide-place-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 8px; list-style: none; padding: 0; margin: 0; }
.guide-place-list a { display: flex; align-items: center; gap: 10px; min-height: 68px; padding: 8px; color: inherit; text-decoration: none; border: 1px solid var(--line); border-radius: 10px; }
.guide-place-list img { width: 64px; height: 54px; border-radius: 6px; object-fit: cover; flex: none; }
.guide-place-text { display: grid; flex: 1; min-width: 0; line-height: 1.4; }
.guide-place-text small, .guide-place-text > span { color: var(--muted); font-size: .85rem; }
.guide-hero summary, .section summary { cursor: pointer; font-weight: 700; }
.guide-hero details[open] > summary, .section details[open] > summary { margin-bottom: 10px; }
.guide-cell-label { display: none; }
@media (max-width: 600px) {
  .section .table-wrap:not(.narrow) table { display: block; min-width: 0; }
  .section .table-wrap:not(.narrow) thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .section .table-wrap:not(.narrow) :is(tbody, tr, td) { display: block; }
  .section .table-wrap:not(.narrow) tr { padding: 8px 10px; }
  .section .table-wrap:not(.narrow) tr + tr { border-top: 1px solid var(--line); }
  .section .table-wrap:not(.narrow) td { padding: 3px 0; border: 0; }
  .section .table-wrap:not(.narrow) .guide-cell-label { display: inline; margin-right: 8px; color: var(--muted); font-weight: 700; }
}

.touch-sort-hint { display: none; }
@media (any-pointer: coarse) {
  .day:has(.day-list > .item + .item) .touch-sort-hint { display: block; margin: 0 0 8px; font-size: .85rem; }
  .item-main .handle { display: grid; place-items: center; flex: 0 0 24px; min-height: 44px; padding: 0; background: transparent; font-size: 1rem; line-height: 1; }
  .item.sortable-chosen .handle { color: var(--accent); }
}

/* 저녁 가이드 */
.night-guide, .night-section, .night-card { display: flex; flex-direction: column; gap: 12px; }
.night-guide { gap: 20px; scroll-margin-top: 76px; }
.night-guide[hidden] { display: none; }
.night-heading h1 { font-size: 1.45rem; }
.night-heading .muted { font-size: .9rem; }
.night-section { scroll-margin-top: 76px; }
.night-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); gap: 12px; }
.night-card { padding: 16px; }
.night-card h4 { font-size: 1.15rem; overflow-wrap: anywhere; }
.night-card header .muted, .night-access { font-size: .9rem; }
.night-links { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.night-card .night-links { margin-top: auto; }
.night-links .btn { min-height: 40px; }
.night-hero img { max-height: 240px; object-fit: cover; }
.night-hero figcaption a { color: inherit; }
.night-facts { display: grid; gap: 6px; margin: 0; }
.night-facts > div { display: grid; grid-template-columns: 2.4rem 1fr; gap: 8px; }
.night-facts dt { font-size: .88rem; color: var(--muted); font-weight: 700; }
.night-facts dd { margin: 0; }

/* 여행 정보 목차 */
.guide-cover { position: relative; isolation: isolate; overflow: hidden; display: flex; justify-content: flex-end; min-height: clamp(235px, 34vw, 385px); padding: clamp(20px, 4vw, 40px); border: 0; border-radius: 22px; background: #1a3029; color: #fffaf0; }
.guide-cover-photo, .guide-cover::after { position: absolute; inset: 0; width: 100%; height: 100%; }
.guide-cover-photo { z-index: -2; object-fit: cover; object-position: center 57%; }
.guide-cover::after { content: ""; z-index: -1; background: linear-gradient(0deg, rgba(9, 26, 20, .94), rgba(12, 33, 27, .53) 50%, rgba(12, 33, 27, .05) 100%); }
.guide-cover-copy h1 { font-size: clamp(1.8rem, 5vw, 3.45rem); line-height: 1.14; letter-spacing: -.055em; text-wrap: balance; }
.guide-cover-copy .dates { margin-top: 7px; font-size: clamp(.86rem, 2vw, 1.05rem); }
.guide-cover-credit { position: absolute; top: 12px; right: 12px; padding: 5px 9px; border-radius: 20px; background: rgba(18, 32, 28, .78); color: #fffaf0; font-size: .74rem; text-decoration: none; }
.guide-cover-credit:hover { text-decoration: underline; }
.guide-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.guide-toc { margin-top: clamp(20px, 3vw, 32px); }
.guide-toc > h2 { margin-bottom: 12px; font-size: clamp(1.18rem, 2.4vw, 1.55rem); letter-spacing: -.03em; }
.guide-toc-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.guide-toc-group { min-width: 0; padding: 12px 14px 6px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: var(--shadow); }
.guide-toc-group header { display: flex; align-items: center; gap: 9px; padding: 0 3px 7px; }
.guide-toc-group h3 { font-size: 1.02rem; letter-spacing: -.015em; }
.guide-toc-icon { display: grid; place-items: center; width: 31px; height: 31px; flex: none; border-radius: 10px; font-size: 1.05rem; font-weight: 750; background: var(--accent-soft); color: var(--accent); }
.guide-toc-icon.tone-blue { background: #e4edef; color: #315665; }
.guide-toc-icon.tone-plum { background: #f1e8ef; color: #71435f; }
.guide-toc-icon.tone-ochre { background: #f5ecd8; color: #725421; }
:root[data-theme="dark"] .guide-toc-icon.tone-blue { background: #23363d; color: #b2d4df; }
:root[data-theme="dark"] .guide-toc-icon.tone-plum { background: #412f3c; color: #e4bed8; }
:root[data-theme="dark"] .guide-toc-icon.tone-ochre { background: #3d3526; color: #e7cd96; }
.guide-toc-group ul { margin: 0; padding: 0; list-style: none; }
.guide-toc-group li { border-top: 1px solid var(--line); }
.guide-toc-group a { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 5px 3px; color: inherit; text-decoration: none; font-weight: 620; line-height: 1.35; }
.guide-toc-group a:hover, .guide-toc-group a:focus-visible { color: var(--accent); }
.guide-toc-arrow { color: var(--accent); font-size: 1.18rem; flex: none; }
@media (min-width: 580px) { .guide-toc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }
@media (min-width: 900px) {
  .guide-toc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
  .guide-toc-group { padding-inline: 17px; }
}

.topbar .travel-home { display: inline-flex; align-items: center; min-height: 44px; padding: 0; }
.travel-home img { display: block; width: 88px; height: 44px; object-fit: contain; }
:root[data-theme="dark"] .travel-home img { filter: grayscale(1) invert(1) brightness(1.2); }
.guide-topbar #plan-link { color: var(--accent); font-weight: 750; }
.guide-topbar .guide-back { display: inline-flex; align-items: center; gap: 9px; min-height: 44px; padding: 0 10px 0 4px; font-size: 1.06rem; font-weight: 800; color: var(--accent); text-decoration: none; }
.guide-back span { font-size: 1.45rem; line-height: 1; }
.night-card[id] { scroll-margin-top: 76px; }
