/* 엄마랑 오사카 — 스타일 (시스템 폰트, 큰 글씨, 한 손 조작) */
:root {
  --bg: #faf7f2;
  --card: #ffffff;
  --text: #1f1f1f;
  --muted: #6b6560;
  --accent: #c8442a;
  --accent-soft: #fbe9e4;
  --ok: #2e7d4f;
  --ok-soft: #e3f3e9;
  --border: #e3ddd5;
  --tabbar-h: 72px;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

html { font-size: 18px; }
html[data-fs="large"] { font-size: 20px; }
html[data-fs="xlarge"] { font-size: 23px; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", "Noto Sans CJK KR", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  overflow-wrap: anywhere;
}
body.no-scroll { overflow: hidden; }

h1, h2, h3 { margin: 0 0 0.4rem; line-height: 1.3; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.15rem; }
p { margin: 0.3rem 0; }
a { color: inherit; }
.muted { color: var(--muted); }
.ja { font-size: 0.95rem; color: var(--muted); }
.big { font-size: 1.3rem; }

/* 상단 바 */
.offline-bar {
  background: #444;
  color: #fff;
  text-align: center;
  font-size: 0.9rem;
  padding: 0.3rem 1rem;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  padding-top: calc(0.55rem + env(safe-area-inset-top));
  background: var(--accent);
  color: #fff;
}
.topbar-left { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.topbar-date { font-weight: 600; }
.topbar-time { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.topbar .badge-accent { background: rgba(255, 255, 255, 0.22); color: #fff; }

/* 본문 */
#main {
  padding: 0.9rem 1rem;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 1rem);
  max-width: 720px;
  margin: 0 auto;
}
.section-title { margin: 1.3rem 0 0.6rem; font-size: 1.1rem; color: var(--muted); }
.day-title { font-size: 1.2rem; margin-bottom: 0.7rem; }

/* 하단 탭 */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--card);
  border-top: 1px solid var(--border);
}
.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--muted);
  -webkit-tap-highlight-color: transparent;
}
.tabbar a.active { color: var(--accent); font-weight: 700; }
.tab-icon { font-size: 1.45rem; line-height: 1; }

/* 카드·알림 */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.9rem 1rem;
  margin-bottom: 0.8rem;
}
.card-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
  margin-bottom: 0.2rem;
}
.stop-card.now { border: 2px solid var(--accent); }
.stop-time { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stop-name { font-size: 1.35rem; margin: 0.15rem 0; }
.stop-note { margin-top: 0.4rem; }
.transit { color: var(--muted); }
.chosen { color: var(--ok); font-weight: 600; }
.flight-main { font-size: 1.2rem; font-weight: 700; }
.notice {
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  margin-bottom: 0.8rem;
}
.notice-error { background: #fde8e8; color: #7a1c1c; }
.notice-plain { background: #eeeae4; }
.row { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; margin: 0.25rem 0; }

.badge {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: #efe9e2;
  color: #4a433d;
  white-space: nowrap;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-danger { background: #fde8e8; color: #b3261e; }
.small { font-size: 0.85rem; }
.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.3rem 0; }
.tag {
  display: inline-block;
  padding: 0.1rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--card);
}

/* 버튼 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-height: 52px;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { background: #f1ece5; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:active { background: #a9351f; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-wide { width: 100%; }
.btn-xl { min-height: 64px; font-size: 1.15rem; }
.btn[disabled], .btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: default; }
/* 티켓 아코디언 */
.ticket { border-top: 1px solid var(--border); }
.ticket:first-of-type { border-top: 0; }
.ticket-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.6rem;
  width: 100%;
  min-height: 52px;
  padding: 0.5rem 0;
  border: 0;
  background: transparent;
  font: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ticket-name { font-weight: 700; flex: 1 1 auto; }
.ticket-price { color: var(--accent); font-weight: 600; font-size: 0.95rem; flex: 1 1 100%; }
.ticket-chevron { color: var(--muted); transition: transform 0.15s; margin-left: auto; order: 2; }
.ticket-name { order: 1; }
.ticket-price { order: 3; }
.ticket.open .ticket-chevron { transform: rotate(180deg); }
.ticket-body { padding: 0 0 0.8rem; }
.ticket-row { display: grid; grid-template-columns: 4.2rem 1fr; gap: 0.5rem; padding: 0.25rem 0; }
.ticket-k { color: var(--muted); font-size: 0.9rem; }
.ticket-v { white-space: pre-wrap; }

.link-item { margin-bottom: 0.7rem; }
.link-item:last-child { margin-bottom: 0; }
.link-item .btn { text-align: center; }
.link-offline-note { margin-top: 0.2rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.7rem; }
.btn-row .btn { flex: 1 1 40%; }

/* 칩 */
.chips {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.2rem 0 0.5rem;
  margin: 0 -1rem;
  padding-left: 1rem;
  padding-right: 1rem;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  min-height: 52px;
  padding: 0.4rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.segmented {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 0.8rem;
  background: var(--card);
}
.segmented button {
  flex: 1;
  min-height: 52px;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.segmented button.active { background: var(--accent); color: #fff; }

/* stop 목록 */
.stop-list, .timeline { list-style: none; margin: 0; padding: 0; }
.stop-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  min-height: 60px;
  padding: 0.6rem 0.9rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  font: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.stop-row-time { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 3.2rem; }
.stop-row-time.muted { font-weight: 500; font-size: 0.85rem; }
.stop-row-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.stop-row-name { font-weight: 600; }
.stop-row-ja, .stop-row-note { font-size: 0.85rem; color: var(--muted); }
.timeline li.past .stop-row { opacity: 0.45; }
.timeline li.current .stop-row { border: 2px solid var(--accent); }

/* 후보 카드 */
.cand-card.chosen { border: 2px solid var(--ok); }
.cand-meta { display: flex; flex-wrap: wrap; gap: 0.3rem 0.9rem; margin: 0.3rem 0; font-size: 0.95rem; }

/* 상세 시트 */
.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); }
.sheet-panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  padding: 0.6rem 1rem calc(1.2rem + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
}
.sheet-close, .fs-close {
  display: block;
  margin-left: auto;
  min-height: 52px;
  padding: 0.4rem 1rem;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.addr-label { margin-top: 0.8rem; font-size: 0.85rem; color: var(--muted); }
.addr-big {
  font-size: 1.6rem;
  line-height: 1.4;
  padding: 0.7rem 0.9rem;
  margin: 0.2rem 0 0.4rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--card);
}
.memo-row { margin-top: 0.8rem; }
.memo-key { font-size: 0.85rem; color: var(--muted); }
.memo-val { font-size: 1.15rem; white-space: pre-wrap; }

/* 전체화면(필수 문장) */
.fullscreen {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  padding: env(safe-area-inset-top) 1rem env(safe-area-inset-bottom);
}
.fs-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 1rem;
  padding-bottom: 2rem;
}
.fs-ja { font-size: 2.6rem; line-height: 1.35; font-weight: 700; }
.fs-ko { font-size: 1.3rem; }
.fs-reading { font-size: 1rem; color: var(--muted); }
.fs-warn { font-size: 0.9rem; color: #7a1c1c; }

/* 필수 문장 카드 */
.phrase-card {
  display: block;
  width: 100%;
  min-height: 60px;
  padding: 0.8rem 1rem;
  margin-bottom: 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  font: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.phrase-ko { font-size: 1.15rem; font-weight: 600; }
.phrase-ja { font-size: 1.05rem; margin-top: 0.1rem; }
.phrase-reading { font-size: 0.85rem; color: var(--muted); }

.mode-card { opacity: 0.85; }
.mode-card .btn-row .btn { pointer-events: none; }

/* 정보 탭 */
.info-list { list-style: none; margin: 0; padding: 0; }
.info-list li { padding: 0.45rem 0; border-bottom: 1px solid var(--border); }
.info-list li:last-child { border-bottom: 0; }
.kv { display: flex; justify-content: space-between; gap: 1rem; padding: 0.35rem 0; }
.kv .k { color: var(--muted); }
.check-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-height: 52px;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.check-item:last-child { border-bottom: 0; }
.check-item input { width: 1.5rem; height: 1.5rem; accent-color: var(--accent); flex: 0 0 auto; }
.check-item.done span { text-decoration: line-through; color: var(--muted); }
.field { margin: 0.6rem 0; }
.field label { display: block; font-size: 0.9rem; color: var(--muted); margin-bottom: 0.25rem; }
.field input[type="password"], .field input[type="text"], .field textarea {
  width: 100%;
  min-height: 52px;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  background: var(--card);
  color: inherit;
}
.field textarea { min-height: 96px; resize: vertical; }
.emergency-row { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }

/* 토스트 */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 1rem);
  transform: translateX(-50%);
  z-index: 70;
  background: #333;
  color: #fff;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  font-size: 0.95rem;
  box-shadow: var(--shadow);
  max-width: calc(100% - 2rem);
}
