:root {
  --paper: #f4efe6;
  --paper-deep: #ece4d4;
  --card: #fffaf2;
  --ink: #241c14;
  --muted: #6b6258;
  --line: #e2d6c4;
  --cinnabar: #6e1f1a;
  --cinnabar-bright: #9a2e26;
  --gold: #c6a15b;
  --gold-soft: #e8d7a8;
  --stone: #3f4a43;
  --ok: #2c5a45;
  --warn: #8a4b12;
  --shadow: 0 10px 30px rgba(36, 28, 20, 0.08);
  --radius: 18px;
  --tab-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Apple SD Gothic Neo", "Noto Sans KR", "Noto Sans CJK KR", "Pretendard", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--paper); color: var(--ink); font-family: var(--font); }
body { min-height: 100dvh; }
button, select, input { font: inherit; color: inherit; }
a { color: inherit; }
img { max-width: 100%; display: block; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.hidden { display: none !important; }

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 420px at 50% -80px, rgba(198, 161, 91, 0.18), transparent 60%),
    var(--paper);
  position: relative;
  padding-bottom: calc(var(--tab-h) + var(--safe-b) + 12px);
}

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
  background: color-mix(in srgb, var(--paper) 86%, white);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; }
.brand-name { margin: 0; font-weight: 750; letter-spacing: -0.03em; font-size: 1.05rem; }
.brand-tag { margin: 1px 0 0; color: var(--muted); font-size: 0.7rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.back-btn {
  width: 40px; height: 40px; border: 0; border-radius: 12px;
  background: var(--paper-deep); cursor: pointer;
}
.back-btn::before { content: "‹"; font-size: 1.4rem; line-height: 1; }
.lang-wrap select {
  appearance: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 28px 8px 12px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 14px) 55%, calc(100% - 9px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  max-width: 118px;
}

.main { padding: 16px 16px 8px; }
.hero {
  background: linear-gradient(160deg, #6e1f1a 0%, #3b1a16 58%, #241c14 100%);
  color: #f8f1e4;
  border-radius: 24px;
  padding: 22px 18px 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute; right: -20px; top: -30px;
  width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(198,161,91,.35), transparent 70%);
}
.hero h1 { margin: 0 0 8px; font-size: 1.55rem; letter-spacing: -0.04em; position: relative; }
.hero p { margin: 0; color: rgba(248,241,228,.82); font-size: 0.92rem; line-height: 1.45; position: relative; }
.btn-primary, .btn-ghost, .btn-link {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 18px; border-radius: 999px;
  text-decoration: none; border: 0; cursor: pointer; font-weight: 700;
}
.btn-primary {
  background: var(--gold);
  color: #2a1d0c;
  width: 100%;
  margin-top: 18px;
  font-size: 1.05rem;
  position: relative;
}
.btn-ghost {
  background: var(--card);
  border: 1px solid var(--line);
  width: 100%;
}
.btn-link {
  background: rgba(255,250,242,.12);
  color: #f8f1e4;
  border: 1px solid rgba(248,241,228,.25);
  width: 100%;
  margin-top: 10px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 14px;
  text-decoration: none;
  min-height: 88px;
  display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: var(--shadow);
}
.tile strong { font-size: 1rem; }
.tile span { color: var(--muted); font-size: 0.78rem; margin-top: 6px; }
.tile.disabled { opacity: 0.72; }
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 999px;
  background: var(--gold-soft); color: #5a3f12;
  font-size: 0.7rem; font-weight: 700;
}
.badge.warn { background: #f3ddc2; color: var(--warn); }
.badge.ok { background: #dceee3; color: var(--ok); }
.note {
  margin-top: 16px; color: var(--muted); font-size: 0.8rem; line-height: 1.5;
}

.filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.search {
  width: 100%; min-height: 46px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--card); padding: 0 14px;
}
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.chips.wrap { flex-wrap: wrap; overflow-x: visible; }
.chip, .type-seg button {
  border: 1px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 8px 12px; white-space: nowrap; cursor: pointer;
}
.chip[aria-pressed="true"], .type-seg button[aria-pressed="true"] {
  background: var(--cinnabar); color: #fff; border-color: var(--cinnabar);
}
.type-seg { display: flex; gap: 8px; }
.count { color: var(--muted); font-size: 0.85rem; margin: 0 0 10px; }

.place-list { display: flex; flex-direction: column; gap: 10px; }
.place-card {
  display: grid; grid-template-columns: 92px 1fr; gap: 12px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; text-decoration: none;
  box-shadow: var(--shadow); min-height: 92px;
}
.thumb {
  background: var(--paper-deep);
  min-height: 92px;
  display: flex; align-items: center; justify-content: center;
}
.thumb img { width: 100%; height: 100%; }
.thumb img.cover { object-fit: cover; }
.thumb img.contain { object-fit: contain; background: #efe8db; }
.thumb.placeholder { color: var(--muted); font-size: 0.72rem; padding: 8px; text-align: center; }
.place-card .body { padding: 10px 12px 10px 0; min-width: 0; }
.place-card h2 { margin: 0; font-size: 1rem; letter-spacing: -0.02em; }
.place-card .meta { margin: 6px 0 0; color: var(--muted); font-size: 0.78rem; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

.detail-photo {
  margin: 0 -16px 16px;
  background: #1d1813;
  min-height: 220px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.detail-photo img { width: 100%; max-height: 280px; }
.detail-photo img.contain { object-fit: contain; }
.detail-photo img.cover { object-fit: cover; max-height: 280px; height: 280px; }
.credit {
  position: absolute; left: 16px; right: 16px; bottom: 10px;
  background: rgba(24, 18, 14, .66); color: #f8f1e4;
  font-size: 0.7rem; padding: 6px 8px; border-radius: 8px;
}
.place-title { margin: 0 0 6px; font-size: 1.45rem; letter-spacing: -0.03em; }
.place-sub { margin: 0 0 14px; color: var(--muted); font-size: 0.9rem; }
.pending-banner {
  background: #f3e6d0; color: #5c3b14;
  border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; font-size: 0.92rem;
}
.block { margin: 0 0 18px; }
.block h3 { margin: 0 0 8px; font-size: 0.82rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.block p, .block address { margin: 0; line-height: 1.6; font-style: normal; white-space: pre-wrap; }
.fee-box, .hours-box {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 14px;
}
.fee-box.unconfirmed { border-color: #e2b684; background: #fff6ea; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0 12px; }
.actions a { text-align: center; font-size: 0.88rem; padding: 8px 10px; line-height: 1.25; white-space: normal; }
.maps-note { margin: 0 0 18px; color: var(--muted); font-size: 0.8rem; line-height: 1.45; }
.map-slot {
  scroll-margin-top: 88px;
  border: 1px dashed var(--line); border-radius: 16px;
  padding: 16px; color: var(--muted); font-size: 0.88rem; line-height: 1.5;
  background: var(--paper-deep); margin-bottom: 16px;
}
.source-box { font-size: 0.8rem; color: var(--muted); line-height: 1.5; }
.source-box a { color: var(--cinnabar-bright); }

.course-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; padding: 18px; box-shadow: var(--shadow);
}
.fieldset { border: 0; margin: 0 0 14px; padding: 0; }
.fieldset legend { font-weight: 700; margin-bottom: 8px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices label {
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; cursor: pointer;
}
.choices input { accent-color: var(--cinnabar); }
.soon { margin-top: 14px; background: #f3e6d0; border-radius: 12px; padding: 12px; color: #5c3b14; }

.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 0; width: 100%; max-width: 480px;
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  background: color-mix(in srgb, var(--card) 92%, white);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + var(--safe-b));
  z-index: 30;
}
.tab {
  text-decoration: none; text-align: center; color: var(--muted);
  padding: 6px 0; border-radius: 12px; font-size: 0.75rem; font-weight: 700;
  display: flex; flex-direction: column; gap: 2px; align-items: center;
}
.tab .tab-icon { font-size: 1.15rem; line-height: 1; }
.tab.active { color: var(--cinnabar); background: rgba(110, 31, 26, 0.06); }

.loading, .error { padding: 40px 16px; text-align: center; color: var(--muted); }

.course-result { margin-top: 18px; scroll-margin-top: 88px; }
.course-result h2 { margin: 0 0 8px; font-size: 1.2rem; letter-spacing: -0.03em; }
.course-meta, .course-method { color: var(--muted); font-size: 0.82rem; line-height: 1.55; margin: 0 0 10px; }
.segment { margin: 16px 0 20px; }
.segment h3 { margin: 0 0 10px; font-size: 1rem; }
.stop {
  display: grid; grid-template-columns: 36px 1fr; gap: 10px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 12px; margin-bottom: 8px;
  box-shadow: var(--shadow);
}
.stop-num {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--cinnabar); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center; font-size: 0.9rem;
}
.stop h4 { margin: 0 0 4px; font-size: 1.02rem; }
.stop .leg { margin: 0 0 6px; color: var(--muted); font-size: 0.78rem; line-height: 1.4; }
.stop .stop-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.stop .stop-actions a {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 0 12px; border-radius: 999px;
  text-decoration: none; font-size: 0.82rem; font-weight: 700;
}
.course-map { margin-top: 10px; }
.course-map .btn-primary, .course-map .btn-ghost { width: 100%; }

.place-card.is-row {
  grid-template-columns: 1fr auto;
  align-items: stretch;
}
.place-card .place-card-main {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.place-card .btn-add-course {
  grid-column: 3;
  grid-row: 1;
  align-self: center;
  width: auto;
  margin: 0 8px 0 0;
  min-height: 44px;
  min-width: 44px;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--cinnabar);
  cursor: pointer;
}
.place-card .btn-add-course.is-in { color: var(--muted); }
.detail-course-btn { width: 100%; margin: 0 0 12px; }

.course-card .btn-ghost { width: 100%; margin-top: 8px; }
.course-alert {
  margin: 10px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  scroll-margin-bottom: calc(var(--tab-h) + 20px);
  scroll-margin-top: 88px;
  background: #f3e6d0;
  color: #5c3b14;
  font-size: 0.86rem;
  line-height: 1.45;
}
.course-alert.ok { background: #dceee3; color: #215338; }
.course-alert.warn { background: #f3ddc2; color: #6a3a10; }
.start-picked { margin: 8px 0 0; font-size: 0.86rem; font-weight: 700; }
.suggest-list {
  list-style: none; margin: 8px 0 0; padding: 0;
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  background: var(--card);
}
.suggest-list li { border-top: 1px solid var(--line); }
.suggest-list li:first-child { border-top: 0; }
.suggest-list button {
  width: 100%; text-align: left; background: transparent; border: 0;
  min-height: 44px; padding: 8px 12px; cursor: pointer; font-size: 0.88rem;
}
.suggest-list button:hover, .suggest-list button:focus { background: rgba(110, 31, 26, 0.06); }
.suggest-list .sub { display: block; color: var(--muted); font-size: 0.75rem; }

.course-toolbar {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px;
}
.course-toolbar button {
  min-height: 44px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card);
  font-weight: 700; font-size: 0.82rem; cursor: pointer;
}
.course-toolbar button.danger { color: var(--cinnabar); }
.stop-edit {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0;
}
.stop-edit button {
  min-width: 44px; min-height: 44px; padding: 0 10px;
  border-radius: 12px; border: 1px solid var(--line);
  background: #fff; font-weight: 700; font-size: 0.78rem; cursor: pointer;
}
.add-box { margin-top: 12px; }
#geoStatus[hidden], .hidden { display: none !important; }

.nearby-block { margin: 16px 0 8px; }
.nearby-block h3 { margin: 0 0 6px; font-size: 1rem; }
.nearby-block .nearby-sub { margin: 0 0 10px; color: var(--muted); font-size: 0.8rem; line-height: 1.45; }
.venue-card, .nearby-item {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 12px; margin-bottom: 8px;
  box-shadow: var(--shadow);
}
.nearby-item { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: start; }
.nearby-item h4, .venue-card h2 { margin: 0 0 4px; font-size: 1rem; }
.venue-card .thumb-row { display: grid; grid-template-columns: 72px 1fr; gap: 10px; margin-bottom: 8px; }
.venue-card .thumb-row .thumb { border-radius: 10px; overflow: hidden; min-height: 72px; }
.venue-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.venue-actions a, .venue-actions button, .nearby-item .venue-actions a, .nearby-item .venue-actions button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 0 12px; border-radius: 999px;
  text-decoration: none; font-size: 0.8rem; font-weight: 700;
  width: auto; margin: 0; cursor: pointer;
}
.list-lead { color: var(--muted); font-size: 0.86rem; line-height: 1.5; margin: 0 0 12px; }
