* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: #f7f5f0;
  color: #1f2937;
}
header.topbar {
  background: #17181c;
  color: #e5e5e5;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}
header.topbar .brand { color: #f5c451; font-weight: 700; }
.wallet {
  display: flex;
  align-items: center;
  gap: 16px;
}
.pill {
  background: #26272c;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
}
.pill.points { color: #f5c451; font-weight: 600; }

main { max-width: 960px; margin: 0 auto; padding: 32px 20px 80px; }
h1.page-title { font-size: 28px; margin: 4px 0 2px; }
.subtitle { color: #6b7280; margin-bottom: 24px; }

.steps { display: flex; gap: 10px; align-items: center; margin: 24px 0 32px; color: #9ca3af; font-size: 14px; }
.steps .step.active { color: #b5651d; font-weight: 700; }
.steps .divider { flex: 1; height: 1px; background: #e5e7eb; }

.card {
  background: #fff;
  border: 1px solid #ece7dc;
  border-radius: 14px;
  padding: 28px;
  margin-bottom: 20px;
}
.card h2 { margin-top: 0; font-size: 20px; }
label { display: block; font-size: 13px; color: #6b7280; margin: 16px 0 6px; }
input[type="email"], input[type="password"], input[type="text"], select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #d9d5c9;
  font-size: 15px;
  background: #fafaf7;
}
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

.btn {
  display: inline-block;
  padding: 13px 20px;
  border-radius: 10px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary { background: #d2691e; color: #fff; width: 100%; margin-top: 20px; }
.btn-primary:hover { background: #b5591a; }
.btn-secondary { background: #f0ede4; color: #1f2937; }
.btn-link { background: none; color: #b5651d; text-decoration: underline; padding: 0; font-weight: 600; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.theme-options { display: flex; gap: 8px; flex-wrap: wrap; }
.theme-chip {
  padding: 10px 14px; border-radius: 999px; border: 1px solid #d9d5c9; background: #fafaf7; cursor: pointer; font-size: 14px;
}
.theme-chip.selected { border-color: #d2691e; background: #fdf1e6; color: #b5591a; }

.msg { padding: 10px 14px; border-radius: 8px; font-size: 14px; margin-top: 12px; }
.msg.error { background: #fee2e2; color: #b91c1c; }
.msg.success { background: #dcfce7; color: #166534; }
.msg.info { background: #e0f2fe; color: #075985; }

.itinerary-day { margin-bottom: 18px; }
.itinerary-day h3 { font-size: 16px; color: #b5651d; margin-bottom: 8px; }
.item { display: flex; gap: 14px; padding: 10px 0; border-bottom: 1px dashed #eee; }
.item .time { width: 56px; color: #6b7280; font-size: 13px; flex-shrink: 0; }
.tag { display: inline-block; font-size: 11px; background: #f0ede4; color: #6b7280; border-radius: 6px; padding: 2px 8px; margin-bottom: 4px; }
.item .title { font-weight: 600; }
.item .desc { color: #6b7280; font-size: 13px; }

.hidden { display: none !important; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal {
  background: #fff; border-radius: 14px; padding: 28px; width: 380px; max-width: 90vw;
}
.modal h3 { margin-top: 0; }
.amount-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.amount-grid button { padding: 12px; border-radius: 10px; border: 1px solid #d9d5c9; background: #fafaf7; cursor: pointer; font-size: 14px; }
.amount-grid button.selected { border-color: #d2691e; color: #b5591a; background: #fdf1e6; }
.summary-row { display: flex; justify-content: space-between; font-size: 14px; padding: 4px 0; color: #6b7280; }
.summary-row.total { color: #1f2937; font-weight: 700; border-top: 1px solid #eee; margin-top: 6px; padding-top: 10px; }
.modal-close { float: right; background: none; border: none; font-size: 18px; cursor: pointer; color: #9ca3af; }
.note { font-size: 12px; color: #9ca3af; margin-top: 10px; line-height: 1.5; }

/* ==== 지도 기반 지역 선택 (원본 루트스테이 데모 UI 그대로) ==== */
:root {
  --forest-dark: #1E4420; --coral: #E8613C; --coral-dark: #C24B2B;
  --gold: #C98A12; --gold-dark: #9A6B12; --ink: #232323; --ink-soft: #585850;
  --line: #E7E4DA;
}

.search-layout { display: grid; grid-template-columns: 380px 1fr; gap: 32px; align-items: start; }
.search-layout #searchCard { padding: 28px; }
.search-layout #searchCard h2 { font-size: 21px; font-weight: 800; margin: 0 0 24px; line-height: 1.4; }

.map-card { background: #EAF1F7; border: none; border-radius: 20px; padding: 18px; position: relative; }
.map-hint { font-size: 12px; color: var(--ink-soft); text-align: center; margin-bottom: 8px; font-weight: 600; min-height: 16px; }
.map-legend { display: flex; gap: 14px; justify-content: center; margin-bottom: 6px; font-size: 11px; color: var(--ink-soft); font-weight: 700; }
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.map-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.map-legend .lo { background: var(--forest-dark); }
.map-legend .lw { background: var(--gold); }
.map-legend .ld { background: var(--coral); }

#mapContainer { width: 100%; }
#mapContainer svg { width: 100%; height: auto; display: block; }
.province { fill: #D7E6D3; stroke: #fff; stroke-width: 1.3; cursor: pointer; transition: fill .12s; }
.province:hover { fill: #C3DBC0; }
.province.has-origin { fill: #B9D6A8; }
.province.has-dest { fill: #F3C3AE; }
.province-label { font-size: 8.5px; font-weight: 700; fill: var(--ink-soft); pointer-events: none; text-anchor: middle; }
.ulleungdo-box-rect { fill: none; stroke: #BBD3B4; stroke-width: 1; stroke-dasharray: 2 2; }
.ulleungdo-shape { fill: #D7E6D3; stroke: #fff; stroke-width: 1; }
.ulleungdo-label { font-size: 7px; fill: var(--ink-soft); font-weight: 700; text-anchor: middle; }
.city-dot { fill: #fff; stroke-width: 2; cursor: pointer; }
.city-dot.origin { fill: var(--forest-dark); stroke: #fff; }
.city-dot.dest { fill: var(--coral); stroke: #fff; }
.city-dot.waypoint { fill: var(--gold); stroke: #fff; }
.city-label { font-size: 10px; font-weight: 800; pointer-events: none; }
.city-label.origin { fill: var(--forest-dark); }
.city-label.dest { fill: var(--coral-dark); }
.city-label.waypoint { fill: var(--gold-dark); font-size: 9px; }
.route-line { stroke: var(--coral); stroke-width: 2; stroke-dasharray: 5 4; fill: none; opacity: 0; }
.route-line.show { opacity: 1; }

/* 지도 팝오버 (지역 클릭 시 도시 선택) */
.map-popover {
  position: absolute; z-index: 20; background: #fff; border-radius: 14px;
  box-shadow: 0 8px 28px rgba(30,25,10,.18); padding: 14px; width: 200px; display: none;
}
.map-popover.show { display: block; }
.map-popover h5 { font-size: 13px; font-weight: 800; margin: 0 0 8px; color: var(--ink); }
.map-popover .mp-city { display: flex; justify-content: space-between; align-items: center; padding: 8px 6px; border-radius: 8px; font-size: 13px; }
.map-popover .mp-city:hover { background: #F1EEE0; }
.map-popover .mp-tag { font-size: 10px; font-weight: 700; padding: 5px 8px; border-radius: 6px; border: none; cursor: pointer; font-family: inherit; margin-left: 4px; }
.map-popover .mp-tag.o { background: #EFF3E5; color: var(--forest-dark); }
.map-popover .mp-tag.w { background: #FCF1DC; color: var(--gold-dark); }
.map-popover .mp-tag.d { background: #FBEAE3; color: var(--coral-dark); }
.map-popover .mp-close { position: absolute; top: 8px; right: 10px; border: none; background: none; font-size: 13px; color: var(--ink-soft); cursor: pointer; }

/* 경유지 행 */
.waypoint-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.waypoint-row .wp-num { width: 22px; height: 22px; border-radius: 50%; background: #FCF1DC; color: var(--gold-dark); font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.waypoint-row select { flex: 1; padding: 11px 12px; font-size: 13.5px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.wp-remove { width: 30px; height: 30px; flex-shrink: 0; border: 1.5px solid var(--line); background: #fff; border-radius: 8px; color: var(--ink-soft); font-size: 13px; cursor: pointer; }
.wp-remove:hover { border-color: var(--coral); color: var(--coral-dark); }
.waypoint-hint { font-size: 11.5px; color: var(--ink-soft); margin-top: 4px; }

/* 여행 일정 4버튼 그리드 */
.duration-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.dur-btn { padding: 10px 8px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; font-size: 13.5px; font-weight: 700; cursor: pointer; color: var(--ink-soft); }
.dur-btn.selected { border-color: var(--forest-dark); background: #EFF3E5; color: var(--forest-dark); }

/* 출발일 / 테마 */
.date-input { width: 100%; padding: 12px 14px; font-size: 14.5px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-family: inherit; }
.theme-hint { font-size: 11.5px; color: var(--ink-soft); margin-top: 6px; }

/* 토스트 */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; opacity: 0; transition: .25s; pointer-events: none; z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 860px) {
  .search-layout { grid-template-columns: 1fr; }
}

/* ===== AI 결과 카드 섹션 (맛집·관광·숙소) ===== */
.result-section { margin-top: 28px; }
.result-section .section-title { font-size: 17px; color: #1f2937; margin-bottom: 2px; display: flex; align-items: center; gap: 6px; }
.result-section .section-sub { font-size: 12.5px; color: #9ca3af; margin: 0 0 14px; }
.result-section .section-sub a { color: #b5651d; }
.place-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.place-card {
  border: 1px solid #ece7dc; border-radius: 14px; padding: 16px; background: #fffdfa;
  transition: transform .12s ease, box-shadow .12s ease; display: flex; flex-direction: column; gap: 6px;
}
.place-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(180,101,29,.10); }
.place-card .pc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.place-card .pc-name { font-weight: 700; font-size: 15px; color: #232323; }
.place-card .pc-badge { font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.badge-미슐랭 { background: #fbe4e0; color: #C24B2B; }
.badge-블루리본 { background: #e0ecfb; color: #1d4ed8; }
.badge-테이블링 { background: #e9f7e4; color: #2f7d32; }
.badge-현지추천 { background: #fdf1e6; color: #b5591a; }
.badge-구석구석 { background: #eae4f7; color: #6d28d9; }
.badge-입점 { background: #fdf1e6; color: #b5591a; }
.place-card .pc-cat { font-size: 12px; color: #9ca3af; }
.place-card .pc-desc { font-size: 13px; color: #585850; line-height: 1.45; }
.place-card .pc-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; padding-top: 8px; }
.place-card .pc-price { font-weight: 700; color: #b5591a; font-size: 14px; }
.place-card .pc-area { font-size: 11px; color: #9ca3af; background: #f5f3ee; padding: 2px 8px; border-radius: 6px; }
.place-card .pc-btn { font-size: 12px; border: 1px solid #d2691e; color: #b5591a; background: #fff; border-radius: 8px; padding: 6px 12px; cursor: pointer; }
.place-card .pc-btn:hover { background: #fdf1e6; }
