:root {
  --bg: #ffffff;
  --bg-soft: #f7f7f7;
  --bg-softer: #fafafa;
  --border: #ebebeb;
  --border-strong: #dddddd;
  --text: #222222;
  --muted: #6a6a6a;
  --primary: #ff385c;
  --primary-soft: #fff4f6;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 10px 28px rgba(0, 0, 0, 0.12);
  --radius: 14px;
  --radius-sm: 10px;
  --header-h: 68px;
  --walking: #1B873F;
  --transit: #1A73E8;
  --driving: #FB8C00;
  --flight:  #8E44AD;
  --home:    #222222;
  --topbar-grad: linear-gradient(180deg, #ffffff 0%, #ffffff 70%, rgba(255,255,255,0.92) 100%);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  height: 100%; width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", "Apple SD Gothic Neo", "Helvetica Neue", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 15px;
  line-height: 1.5;
}

button {
  font-family: inherit; cursor: pointer; border: none; background: none; color: inherit;
}
img { max-width: 100%; display: block; }

/* ---------------------- TOP BAR ---------------------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--topbar-grad);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px;
  z-index: 1000;
  backdrop-filter: saturate(180%) blur(8px);
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; flex-shrink: 1; }
.logo { font-size: 30px; line-height: 1; flex-shrink: 0; }
.brand-text { min-width: 0; }
.title { font-weight: 700; font-size: 17px; letter-spacing: -0.015em; white-space: nowrap; line-height: 1.2; }
.subtitle { font-size: 12px; color: var(--muted); display: flex; gap: 5px; flex-wrap: wrap; }
.dot-sep { color: var(--border-strong); }

.day-tabs {
  display: flex; gap: 3px; align-items: center;
  background: var(--bg-soft);
  padding: 4px; border-radius: 999px;
  flex-shrink: 0;
}
.day-tab {
  padding: 7px 14px;
  border-radius: 999px;
  font-weight: 600; font-size: 13px;
  color: var(--muted);
  transition: all 0.15s ease;
  white-space: nowrap;
  display: flex; align-items: center; gap: 6px;
}
.day-tab:hover { color: var(--text); }
.day-tab .day-tab-date { font-size: 11.5px; font-weight: 500; opacity: .6; }
.day-tab.active {
  background: var(--text); color: white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}
.day-tab.active .day-tab-date { opacity: .8; color: white; }

/* ---------------------- LAYOUT ---------------------- */
.layout {
  position: fixed; top: var(--header-h); left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: 440px 1fr;
  min-height: 0;
}

/* split handle (모바일 only — drag로 지도 높이 조절) */
.split-handle { display: none; }

/* ---------------------- SIDEBAR ---------------------- */
.sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 18px 100px 18px;
  scroll-behavior: smooth;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: #c2c2c2; }
.sidebar::-webkit-scrollbar-track { background: transparent; }

.day-header {
  padding: 6px 4px 18px 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.day-header .day-label {
  font-size: 22px; font-weight: 700; letter-spacing: -0.025em;
  display: flex; align-items: center; gap: 10px;
}
.day-color-bar { width: 4px; height: 24px; border-radius: 2px; flex-shrink: 0; }
.day-header .day-theme {
  font-size: 13.5px; color: var(--muted);
  margin-top: 6px; line-height: 1.45;
}
.day-stats {
  display: flex; gap: 14px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}
.day-stats span { display: inline-flex; align-items: center; gap: 4px; transition: opacity 0.3s ease; }
.day-stats .stat-num { font-weight: 700; color: var(--text); }
.day-stats .stat-pending { opacity: 0.4; }

/* day header — 날씨 요약 */
.day-weather {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 10px;
  padding: 6px 10px;
  background: var(--bg-soft);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  flex-wrap: wrap;
}
.day-weather.needs-umbrella { background: #E3F2FD; border: 1px solid #BBDEFB; }
.day-weather .dw-icon   { font-size: 18px; line-height: 1; }
.day-weather .dw-temp   { font-weight: 700; letter-spacing: -0.01em; }
.day-weather .dw-precip { color: #1565C0; font-size: 12px; font-weight: 600; }
.day-weather .dw-pp     { color: var(--muted); font-size: 12px; }
.day-weather .dw-desc   { color: var(--muted); font-size: 12px; }
.day-weather .dw-umbrella {
  font-size: 12px; font-weight: 700; color: #0D47A1;
  background: #FFFFFF; padding: 1px 8px; border-radius: 999px;
  border: 1px solid #90CAF9;
}

/* item — 시간대 날씨 chip */
.item-weather {
  display: inline-flex; align-items: center; gap: 3px;
  margin-left: 6px;
  padding: 1px 6px;
  background: var(--bg-soft);
  border-radius: 999px;
  font-size: 11px;
  color: var(--text);
  font-weight: 600;
}
.item-weather.needs-umbrella { background: #E3F2FD; }
.item-weather .iw-icon   { font-size: 12px; line-height: 1; }
.item-weather .iw-precip { color: #1565C0; margin-left: 2px; font-weight: 700; }
.item-weather .iw-pp     { color: #1A73E8; margin-left: 2px; }
.item-weather .iw-umbrella { margin-left: 2px; }

/* item — 일본어 회화 cheat sheet */
.item-phrases {
  margin-top: 8px;
  background: #FAFAFA;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12.5px;
}
.item-phrases > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
  list-style: none;
  padding: 4px 0;
  user-select: none;
}
.item-phrases > summary::-webkit-details-marker { display: none; }
.item-phrases[open] > summary { color: var(--text); border-bottom: 1px solid var(--border); margin-bottom: 6px; padding-bottom: 6px; }
.item-phrases ul { list-style: none; margin: 0; padding: 0; }
.item-phrases li { padding: 6px 0; border-bottom: 1px dashed var(--border); }
.item-phrases li:last-child { border-bottom: none; }
.ph-ko { font-weight: 600; color: var(--text); }
.ph-jp { color: #1A73E8; margin-top: 2px; font-size: 13px; }
.ph-ro { color: var(--muted); font-size: 11.5px; margin-top: 1px; font-style: italic; }

/* 막차 + 숙소 복귀 카드 */
.return-card {
  list-style: none;
  margin: 18px 0 8px 0;
  padding: 12px 14px;
  background: linear-gradient(135deg, #F5F7FA 0%, #E8EEF5 100%);
  border: 1px solid #CBD5E0;
  border-radius: 10px;
  font-size: 13px;
  display: flex; flex-direction: column; gap: 4px;
}
.return-card.return-card-loading { opacity: 0.7; }
.return-card .rc-title  { font-weight: 700; font-size: 14px; color: var(--text); }
.return-card .rc-route  { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.return-card .rc-time   { color: var(--text); font-weight: 600; }
.return-card .rc-lines  { color: #1A73E8; font-size: 12.5px; }
.return-card .rc-lasttrain { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.return-card .rc-lasttrain.warn {
  color: #C62828; font-weight: 700;
  background: #FFEBEE; padding: 3px 8px; border-radius: 6px; align-self: flex-start;
}
.return-card .rc-warn   { color: #C62828; font-weight: 600; }
.return-card .rc-taxi   { color: var(--muted); font-size: 12px; margin-top: 4px; padding-top: 4px; border-top: 1px dashed #CBD5E0; }
.return-card .rc-muted  { color: var(--muted); font-style: italic; }

/* 출발 권장 배지 (신호등) */
.item-departure {
  display: inline-flex; align-items: center;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.item-departure:empty { display: none; }
.item-departure.dep-future { background: #ECEFF1; color: #455A64; font-weight: 600; }
.item-departure.dep-green  { background: #E8F5E9; color: #2E7D32; }
.item-departure.dep-yellow { background: #FFF8E1; color: #EF6C00; animation: pulse-soft 1.5s ease-in-out infinite; }
.item-departure.dep-red    { background: #FFEBEE; color: #C62828; animation: pulse-soft 1s ease-in-out infinite; }
@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

/* 알림 버튼 active 상태 */
#notifBtn.active { background: #FFF3CD; color: #8B6914; border-color: #FFD54F; }
#notifBtn.active span { filter: drop-shadow(0 0 2px rgba(255, 213, 79, 0.6)); }

/* 숙소 버튼 강조 */
.ctrl-btn-accent { background: #E8F5E9; border-color: #66BB6A; }
.ctrl-btn-accent:hover { background: #C8E6C9; }

/* 온보딩 (일정 미작성 안내) */
.onboarding {
  list-style: none;
  padding: 18px 20px;
  background: #F5F7FA;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin: 8px 4px;
}
.onboarding h3 { margin: 0 0 8px; font-size: 17px; color: var(--text); }
.onboarding p { font-size: 13.5px; color: var(--muted); line-height: 1.6; margin: 6px 0; }
.onboarding ol { margin: 10px 0; padding-left: 20px; }
.onboarding li { font-size: 13.5px; color: var(--text); line-height: 1.7; }
.onboarding code { background: var(--bg-soft); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.onboarding .ob-hint { font-size: 12px; color: var(--muted); margin-top: 12px; }

/* 숙소 정보 모달 */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: white;
  border-radius: 12px;
  max-width: 640px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  padding: 24px 28px 32px;
  position: relative;
  box-shadow: 0 12px 48px rgba(0,0,0,0.25);
  outline: none;
}
.modal-close {
  position: absolute;
  top: 8px; right: 12px;
  background: none; border: none;
  font-size: 28px; line-height: 1;
  color: #999; cursor: pointer;
  padding: 4px 10px;
}
.modal-close:hover { color: #333; }

.stay-title { margin: 0 0 4px 0; font-size: 18px; color: var(--text); }
.stay-sub   { color: var(--muted); font-size: 12.5px; margin-bottom: 18px; }
.stay-section { margin-bottom: 20px; }
.stay-section h3 { margin: 0 0 8px 0; font-size: 14px; color: var(--text); border-left: 3px solid var(--primary); padding-left: 8px; }
.stay-section p { margin: 4px 0; font-size: 13.5px; }
.stay-section .stay-tip { color: var(--muted); font-size: 12px; background: #FFF8E1; padding: 6px 10px; border-radius: 6px; margin-top: 8px; }
.stay-section .stay-warn { color: #C62828; font-weight: 600; font-size: 12.5px; background: #FFEBEE; padding: 8px 12px; border-radius: 6px; }
.stay-section .stay-note { color: var(--muted); font-size: 12px; }

/* 도어락 코드 카드 */
.stay-codes-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stay-code {
  background: linear-gradient(135deg, #1A237E 0%, #283593 100%);
  color: white;
  border-radius: 10px;
  padding: 14px 12px;
  text-align: center;
}
.stay-code .sc-room { font-size: 13px; opacity: 0.85; font-weight: 600; }
.stay-code .sc-num  { font-size: 32px; font-weight: 800; letter-spacing: 6px; margin: 4px 0; font-family: 'SF Mono', Monaco, monospace; }
.stay-code .sc-lock { font-size: 10.5px; opacity: 0.75; }

/* 전화 링크 */
.stay-tel { font-size: 18px; font-weight: 700; color: var(--primary); text-decoration: none; padding: 6px 14px; background: var(--bg-soft); border-radius: 8px; display: inline-block; }
.stay-tel:hover { background: var(--border); }

/* rules / 리스트 */
.stay-ul { list-style: disc inside; padding: 0; margin: 4px 0; }
.stay-ul li { font-size: 12.5px; padding: 3px 0; line-height: 1.5; }
.stay-rules { list-style: none; padding: 0; margin: 0; }
.stay-rules li { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.stay-rules li:last-child { border-bottom: none; }
.stay-rules .sr-icon { font-size: 16px; flex-shrink: 0; }
.stay-rules .sr-text { flex: 1; }
.stay-rules .sr-penalty { color: #C62828; font-size: 11px; font-weight: 600; background: #FFEBEE; padding: 2px 6px; border-radius: 4px; align-self: center; }
.stay-checkout li { font-weight: 600; }

/* 위반 비용 테이블 */
.stay-pen-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.stay-pen-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); }
.stay-pen-table td.pen-amount { text-align: right; color: #C62828; font-weight: 700; }

.items { list-style: none; margin: 0; padding: 0; position: relative; }

/* day section header (전체 모드) */
.day-section {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 4px 10px 4px;
  margin: 4px 0 2px 0;
  border-top: 1px solid var(--border);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
  position: sticky;
  top: -1px;
  background: white;
  z-index: 9;
}
.day-section:first-child { border-top: none; padding-top: 6px; }
.day-sec-bar {
  width: 4px; height: 18px;
  border-radius: 2px;
  background: var(--sec-color);
}
.day-sec-label { color: var(--text); }

/* (빨간 줄 제거 — 진행 중 일정은 .item.now 강조로 표시) */

/* past/now/future — 진행 중 일정 강조 (빨간 줄 대신) */
.item.past { opacity: 0.5; }
.item.past .item-thumb img { filter: grayscale(0.4) brightness(0.95); }
.item.past .item-title { text-decoration: line-through; text-decoration-color: rgba(0,0,0,0.25); }
.item.now {
  background: linear-gradient(180deg, #fff4f6 0%, #ffe4ea 100%);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary), 0 4px 16px rgba(255,56,92,0.18);
  margin: 12px 0;
}
.item.now .item-title { color: var(--primary-strong, #c00d3a); font-weight: 700; }
.item.now::before {
  content: '';
  position: absolute;
  left: -2px; top: 50%;
  transform: translateY(-50%);
  width: 4px; height: 60%;
  background: var(--primary);
  border-radius: 2px;
  animation: nowPulse 1.6s ease-in-out infinite;
}
.item.now::after {
  content: '🔴 진행 중';
  position: absolute;
  top: -10px; right: 12px;
  background: var(--primary);
  color: white;
  font-size: 10.5px; font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 10px rgba(255,56,92,0.35);
  z-index: 1;
}
@keyframes nowPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.item {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.2s ease;
  border: 1px solid transparent;
  margin-bottom: 4px;
  position: relative;
}
.item:hover { background: var(--bg-softer); border-color: var(--border); }
.item.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(255,56,92,0.12);
}
.item.is-home { background: linear-gradient(180deg, #fafafa, #f0f0f0); border-color: #ddd; }
.item.is-home.active { background: linear-gradient(180deg, var(--primary-soft), #ffd6df); }

.item-thumb {
  position: relative;
  width: 96px; height: 96px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: linear-gradient(135deg, #f0f0f0 0%, #e8e8e8 100%);
  flex-shrink: 0;
}
.item-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.item:hover .item-thumb img { transform: scale(1.05); }
.item-thumb-placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; color: rgba(0,0,0,0.18); user-select: none;
}
.item-thumb-num {
  position: absolute;
  top: 6px; left: 6px;
  background: var(--num-bg, rgba(0,0,0,0.6));
  color: white;
  font-weight: 700; font-size: 11px;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.02em;
  backdrop-filter: blur(4px);
}
.item.is-home .item-thumb-num { background: var(--home); }

.item-body { min-width: 0; padding-top: 2px; }
.item-time {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}
.item-time .time-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--time-color, var(--primary));
  box-shadow: 0 0 0 2px white, 0 0 0 3px var(--time-color, var(--primary));
}
.item-head { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; flex-wrap: wrap; }
.type-chip {
  display: inline-flex; align-items: center;
  font-size: 10.5px; font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text);
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.type-chip.공항 { background: #FFEEEE; color: #C92A2A; }
.type-chip.이동 { background: #E3F2FD; color: #1565C0; }
.type-chip.숙소 { background: #2A2A2A; color: #ffffff; }
.type-chip.식사 { background: #FFF3E0; color: #E65100; }
.type-chip.관광 { background: #E8F5E9; color: #2E7D32; }
.type-chip.쇼핑 { background: #FCE4EC; color: #AD1457; }
.type-chip.주류 { background: #FFF8E1; color: #F57F17; }

.item-title {
  font-weight: 600; font-size: 14.5px;
  letter-spacing: -0.012em;
  line-height: 1.35;
  margin-bottom: 4px;
  overflow-wrap: break-word;
}
.item-note {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.item.active .item-note { -webkit-line-clamp: unset; display: block; }

/* place details (정적 places.json) */
.item-place {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.item-place:empty { display: none; }
.item-place .pl-pills {
  display: flex; gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.item-place .pl-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px;
  background: var(--bg-soft);
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--text);
  font-weight: 500;
  line-height: 1.3;
}
.item-place .pl-pill-i { font-size: 12px; }
.item-place .pl-tips {
  display: none;
  list-style: none;
  margin: 0; padding: 0;
}
.item.active .item-place .pl-tips { display: block; }
.item-place .pl-tips li {
  position: relative;
  padding: 4px 0 4px 18px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text);
}
.item-place .pl-tips li::before {
  content: '💡';
  position: absolute; left: 0; top: 4px;
  font-size: 11px;
}

.item-extract {
  display: none;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.item.active .item-extract { display: block; }
.item-extract .extract-label { font-size: 10.5px; font-weight: 700; color: var(--border-strong); letter-spacing: .05em; margin-right: 4px; }

.item-meta { display: none; margin-top: 10px; gap: 6px; flex-wrap: wrap; }
.item.active .item-meta { display: flex; }
.meta-pill {
  font-size: 11.5px;
  background: white;
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--text);
  font-weight: 500;
  display: inline-flex; align-items: center; gap: 4px;
}
.meta-pill a { color: inherit; text-decoration: none; }
.meta-pill.walking { color: var(--walking); border-color: #cce5d2; }
.meta-pill.transit { color: var(--transit); border-color: #cfe2fb; }
.meta-pill.driving { color: var(--driving); border-color: #ffd8b3; }
.meta-pill.flight  { color: var(--flight);  border-color: #e0c5ee; }

/* connector */
.connector {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 16px 6px 110px;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
  min-height: 28px;
  position: relative;
}
.connector .conn-line {
  flex-shrink: 0;
  width: 2px;
  height: 100%;
  min-height: 22px;
  background: linear-gradient(180deg, var(--seg-color, var(--border-strong)), var(--seg-color-end, var(--border)));
  margin-left: -54px;
  margin-right: 12px;
}
.connector.walking { --seg-color: var(--walking); --seg-color-end: rgba(27, 135, 63, 0.4); }
.connector.transit { --seg-color: var(--transit); --seg-color-end: rgba(26, 115, 232, 0.4); }
.connector.driving { --seg-color: var(--driving); --seg-color-end: rgba(251, 140, 0, 0.4); }
.connector.flight  { --seg-color: var(--flight);  --seg-color-end: rgba(142, 68, 173, 0.4); }
.conn-icon { font-size: 13px; }
.connector.walking .conn-icon { color: var(--walking); }
.connector.transit .conn-icon { color: var(--transit); }
.connector.driving .conn-icon { color: var(--driving); }
.connector.flight  .conn-icon { color: var(--flight); }
.conn-text { white-space: normal; }
.conn-fallback { font-size: 10.5px; color: var(--muted); opacity: .8; }

/* transit 상세 (노선·역·방면·시각) — 항상 표시 */
.connector { flex-wrap: wrap; height: auto; min-height: 28px; padding-top: 4px; padding-bottom: 4px; }
.conn-transit {
  display: block;
  width: 100%;
  margin-left: 22px;
  margin-top: 6px;
  padding-left: 12px;
  border-left: 2px dotted var(--border-strong);
}
.ct-row {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 11px; color: var(--text);
  padding: 4px 0;
  flex-wrap: wrap;
}
.ct-line {
  display: inline-block;
  background: var(--transit);
  color: white;
  font-weight: 700;
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.02em;
  min-width: 44px;
  text-align: center;
  flex-shrink: 0;
}
.ct-route { color: var(--text); font-size: 11.5px; flex: 1; }
.ct-stop  { font-weight: 600; }
.ct-arrow { color: var(--muted); margin: 0 4px; }
.ct-headsign {
  display: inline-block;
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 4px;
}
.ct-meta { color: var(--muted); font-size: 10.5px; text-align: right; min-width: 70px; }
.ct-time { color: var(--text); font-weight: 600; font-size: 10.5px; }
.ct-transfer {
  font-size: 10px;
  color: #C62828;
  font-weight: 700;
  padding: 4px 0 4px 4px;
  letter-spacing: 0.05em;
}

/* ---------------------- MAP ---------------------- */
.map-wrap { position: relative; min-height: 0; }
#map { position: absolute; inset: 0; background: #e9eef2; }
.no-key {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; color: var(--muted);
  padding: 24px; font-size: 14px;
}
.no-key code {
  background: var(--bg-soft);
  padding: 2px 6px; border-radius: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

.legend {
  position: absolute;
  bottom: calc(22px + var(--safe-bottom));
  left: 22px;
  background: rgba(255,255,255,0.96);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 14px;
  display: flex; gap: 14px;
  font-size: 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(4px);
  z-index: 5;
  flex-wrap: wrap;
  max-width: calc(100% - 100px);
}
.legend-item { display: flex; align-items: center; gap: 6px; color: var(--text); font-weight: 500; }
.legend svg { display: inline-block; vertical-align: middle; }
.legend-divider {
  width: 1px; height: 14px;
  background: var(--border);
  margin: 0 2px;
}
.legend-active {
  display: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.legend-active.on { display: inline-flex; opacity: 1; }

.map-controls {
  position: absolute;
  top: 60px; right: 14px;  /* Google fullscreen 버튼(우상단)과 겹치지 않게 60px 아래로 */
  display: flex; flex-direction: column; gap: 8px;
  z-index: 5;
}

.map-search {
  position: absolute;
  top: 14px; left: 14px;
  display: flex; align-items: center;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 0 10px;
  height: 44px;
  width: 300px;
  max-width: calc(100% - 28px);
  z-index: 6;
}
.map-search:focus-within { border-color: var(--primary); box-shadow: var(--shadow-hover); }
.map-search .search-icon { font-size: 14px; margin-right: 6px; opacity: 0.6; }
.map-search input {
  flex: 1; border: none; outline: none;
  font: inherit; font-size: 14px;
  background: transparent; color: var(--text);
  padding: 0; min-width: 0;
}
.map-search input::placeholder { color: #999; }
.map-search .search-clear {
  border: none; background: transparent;
  font-size: 22px; cursor: pointer; color: #999;
  padding: 0 6px; line-height: 1;
}
.map-search .search-clear:hover { color: var(--primary); }
.search-clear.hidden { display: none; }

/* Places Autocomplete dropdown — 지도 control 위로 */
.pac-container { z-index: 100000 !important; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.15); border: 1px solid var(--border); margin-top: 2px; }
.pac-item { padding: 8px 12px; font-size: 13px; cursor: pointer; }
.pac-item:hover { background: var(--bg-soft); }
.pac-item-query { font-size: 13px; font-weight: 600; color: var(--text); }
.pac-matched { font-weight: 700; color: var(--primary); }
/* Google Places autocomplete dropdown */
.pac-container { z-index: 1000; font-family: inherit; margin-top: 2px; }
.pac-item { padding: 8px 10px; cursor: pointer; font-size: 13px; }
.pac-item:hover { background: #f5f5f5; }
.pac-item-query { font-size: 13px; font-weight: 600; }
.pac-matched { color: var(--primary); }
.ctrl-btn {
  width: 44px; height: 44px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
  transition: all 0.15s ease;
  position: relative;
}
.ctrl-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-hover); }
.ctrl-btn.active { color: var(--primary); border-color: var(--primary); }
.ctrl-btn.locating .locate-icon {
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.route-loading {
  position: absolute;
  bottom: calc(22px + var(--safe-bottom));
  right: 22px;
  background: rgba(255,255,255,0.96);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12px; color: var(--muted);
  display: flex; align-items: center; gap: 8px;
  box-shadow: var(--shadow);
  z-index: 5;
  transition: opacity 0.3s ease;
}
.route-loading.hidden { opacity: 0; pointer-events: none; }
.spinner {
  width: 12px; height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* InfoWindow */
.gm-style .gm-style-iw-c {
  border-radius: var(--radius) !important;
  padding: 12px 14px !important;
  box-shadow: var(--shadow-hover) !important;
}
.gm-style .gm-style-iw-d { overflow: hidden !important; }
/* X 버튼 살림 — 모바일에서 닫기 쉽게. 위치만 살짝 조정 */
.gm-style .gm-ui-hover-effect {
  top: 2px !important;
  right: 2px !important;
  width: 28px !important;
  height: 28px !important;
}
.gm-style .gm-ui-hover-effect span {
  margin: 6px !important;
  width: 16px !important;
  height: 16px !important;
}

/* PWA install prompt */
.install-prompt {
  position: fixed;
  bottom: calc(20px + var(--safe-bottom));
  left: 8px; right: 8px;
  margin: 0 auto;
  max-width: 460px;
  background: rgba(34,34,34,0.95);
  color: white;
  padding: 10px 12px 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 2000;
  box-shadow: var(--shadow-hover);
  display: flex; align-items: center; gap: 8px;
  flex-wrap: nowrap;
  backdrop-filter: blur(8px);
}
.install-prompt > span {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.install-prompt button {
  background: var(--primary); color: white;
  font-weight: 600; font-size: 12px;
  padding: 5px 12px; border-radius: 999px;
  flex-shrink: 0;
  white-space: nowrap;
}
.install-prompt #installClose {
  background: rgba(255,255,255,0.15);
  width: 24px; height: 24px;
  padding: 0; font-size: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.install-prompt.hidden { display: none; }

/* ---------------------- RESPONSIVE ---------------------- */
@media (max-width: 980px) {
  :root { --header-h: 60px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .title { font-size: 15px; }
  .subtitle { font-size: 11px; }
  .subtitle span:nth-child(n+5) { display: none; }
  .day-tab { padding: 6px 10px; font-size: 12px; gap: 4px; }
  .day-tab .day-tab-date { font-size: 10.5px; }
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: var(--map-h, 42vh) 14px 1fr;
  }
  .map-wrap { order: 1; border-bottom: 1px solid var(--border); }
  .split-handle {
    display: block;
    order: 2;
    background: var(--bg-soft);
    cursor: ns-resize;
    touch-action: none;
    position: relative;
    border-bottom: 1px solid var(--border);
  }
  .split-handle::after {
    content: '';
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    width: 44px; height: 4px;
    background: var(--border-strong);
    border-radius: 2px;
  }
  .split-handle:active::after,
  .split-handle:hover::after { background: var(--primary); }
  .sidebar { order: 3; padding: 14px 12px 100px 12px; }
  .legend { bottom: 10px; left: 10px; padding: 7px 10px; gap: 10px; font-size: 11px; }
  .map-controls { top: 10px; right: 10px; gap: 6px; }
  .ctrl-btn { width: 40px; height: 40px; }
  .map-search {
    top: 10px; left: 10px;
    width: calc(100% - 130px);  /* 우상단 fullscreen + 우측 ctrl-btns 공간 확보 */
    height: 40px;
    padding: 0 8px;
  }
  .map-search input { font-size: 13px; }
  .route-loading { bottom: 10px; right: 10px; padding: 6px 10px; font-size: 11px; }
  .item { grid-template-columns: 84px 1fr; gap: 10px; padding: 10px; }
  .item-thumb { width: 84px; height: 84px; }
  .connector { padding-left: 100px; }
  .connector .conn-line { margin-left: -52px; }
}

@media (max-width: 560px) {
  .day-tabs { gap: 1px; padding: 3px; }
  .day-tab { padding: 5px 8px; font-size: 11.5px; }
  .day-tab .day-tab-date { display: none; }
  .item { grid-template-columns: 72px 1fr; }
  .item-thumb { width: 72px; height: 72px; }
  .connector { padding-left: 88px; }
  .connector .conn-line { margin-left: -46px; }
}
