* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --primary: #FF5722;
  --primary-light: #FF7043;
  --bg: #FFF8F5;
  --bg-card: #FFFFFF;
  --text: #1A1A1A;
  --text-sub: #666666;
  --border: #F0E6E0;
  --active-bg: #FF5722;
  --active-text: #FFFFFF;
  --header-h: 56px;
  --dist-filter-h: 48px;
  --cat-filter-h: 48px;
  --filters-total: calc(var(--header-h) + var(--dist-filter-h) + var(--cat-filter-h) + 36px);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
}

/* 뷰 전환 */
.view { display: none; }
.view.active { display: flex; }
.view.hidden { display: none; }

/* 홈 뷰 */
#view-home {
  min-height: 100dvh;
  justify-content: center;
  align-items: center;
}

.home-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px 32px;
  text-align: center;
}

.home-logo {
  font-size: 72px;
  line-height: 1;
}

.home-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
}

.home-desc {
  font-size: 16px;
  color: var(--text-sub);
  line-height: 1.6;
}

.btn-primary {
  margin-top: 8px;
  padding: 16px 40px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  max-width: 280px;
}

.btn-primary:active { opacity: 0.85; }

.home-error {
  font-size: 14px;
  color: #E53935;
  text-align: center;
}

/* 결과 뷰 */
#view-result {
  flex-direction: column;
  min-height: 100dvh;
}

/* 헤더 */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  height: var(--header-h);
  background: var(--primary);
  color: white;
  padding: 0 12px;
  gap: 8px;
}

.header-title {
  flex: 1;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}

.icon-btn {
  background: none;
  border: none;
  color: white;
  font-size: 22px;
  cursor: pointer;
  padding: 8px;
  min-width: 40px;
  text-align: center;
}

/* 필터 바 */
.filter-bar {
  position: sticky;
  z-index: 90;
  background: white;
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}

.filter-bar::-webkit-scrollbar { display: none; }

.distance-filter { top: var(--header-h); }
.category-filter { top: calc(var(--header-h) + var(--dist-filter-h)); }

.filter-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: white;
  color: var(--text-sub);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.filter-btn.active {
  background: var(--active-bg);
  color: var(--active-text);
  border-color: var(--active-bg);
  font-weight: 600;
}

/* 결과 상태 */
.result-status {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-sub);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

/* 로딩 */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 60px 20px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* 카드 목록 */
.card-list {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 32px;
}

/* 맛집 카드 */
.place-card {
  background: var(--bg-card);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: box-shadow 0.15s;
}

.place-card:active {
  box-shadow: 0 2px 12px rgba(255,87,34,0.18);
  border-color: var(--primary);
}

.card-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-rank {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
  min-width: 28px;
}

.card-category {
  font-size: 13px;
  color: var(--text-sub);
  background: var(--bg);
  padding: 3px 8px;
  border-radius: 10px;
}

.card-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.card-distance {
  font-size: 13px;
  color: var(--text-sub);
}

.card-footer {
  display: flex;
  justify-content: flex-end;
}

.btn-blog {
  padding: 8px 16px;
  background: #03C75A;
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.btn-blog:active { opacity: 0.85; }

/* 빈 상태 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-sub);
}

.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; line-height: 1.6; }

/* 토스트 */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30,30,30,0.9);
  color: white;
  padding: 12px 20px;
  border-radius: 24px;
  font-size: 14px;
  z-index: 999;
  white-space: nowrap;
  animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.hidden { display: none !important; }

/* ── 바텀시트 ── */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
}

.detail-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-radius: 20px 20px 0 0;
  padding: 16px 20px 40px;
  z-index: 201;
  transform: translateY(100%);
  transition: transform 0.28s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-sheet.open {
  transform: translateY(0);
}

.sheet-handle {
  width: 40px;
  height: 4px;
  background: #DDD;
  border-radius: 2px;
  margin: 0 auto 8px;
}

.sheet-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-sub);
  cursor: pointer;
  padding: 4px;
}

.sheet-category {
  font-size: 13px;
  color: var(--text-sub);
}

.sheet-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.sheet-distance {
  font-size: 14px;
  color: var(--primary);
  font-weight: 600;
}

.sheet-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.sheet-info-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: var(--text);
}

.sheet-info-icon {
  width: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.sheet-phone-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}

.sheet-phone-link:active {
  color: var(--primary);
}

.sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.btn-kakao {
  display: block;
  text-align: center;
  background: var(--primary);
  color: #fff;
  padding: 13px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.sheet-actions .btn-blog {
  display: block;
  text-align: center;
  padding: 13px;
  border-radius: 12px;
  font-size: 15px;
}

/* 근거 배지 */
.card-badge {
  margin-top: 6px;
  font-size: 13px;
  color: #6B4A3A;
  letter-spacing: -0.2px;
}
