/* ===== BuildGram Mobile Web — Design System ===== */
:root {
  --bg: #ffffff;
  --bg-secondary: #f8f9fa;
  --gray-50: #f8f9fa;
  --gray-100: #f1f3f5;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-400: #ced4da;
  --gray-500: #adb5bd;
  --gray-600: #868e96;
  --gray-700: #495057;
  --gray-800: #343a40;
  --gray-900: #212529;
  --accent: #e94560;
  --accent-light: #ff6b81;
  --blue: #4a7bf7;
  --green: #40c057;
  --red: #fa5252;
  --orange: #fd7e14;
  --tab-height: 60px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--gray-800);
  -webkit-font-smoothing: antialiased;
}

#app {
  height: 100%;
  max-width: 430px;
  margin: 0 auto;
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  box-shadow: 0 0 40px rgba(0,0,0,0.08);
}

/* ===== Screen Content ===== */
#screen-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  position: relative;
}
#screen-content::-webkit-scrollbar { width: 0; }

/* ===== Bottom Tab Bar ===== */
#tab-bar {
  height: var(--tab-height);
  padding-bottom: var(--safe-bottom);
  border-top: 1px solid var(--gray-200);
  display: flex;
  background: var(--bg);
  flex-shrink: 0;
  z-index: 100;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  color: var(--gray-500);
  font-size: 10px;
  font-weight: 500;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.tab.active { color: var(--gray-900); }
.tab .tab-icon { width: 22px; height: 22px; }

/* 라벨 OFF 모드 — SHOW_NAV_LABELS=false (default) */
#tab-bar.no-label .tab span { display: none; }
#tab-bar.no-label .tab { gap: 0; }
#tab-bar.no-label .tab .tab-icon { width: 28px; height: 28px; }

/* ===== Header ===== */
.screen-header {
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--gray-200);
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
}
.screen-header .back-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-right: 8px;
  font-size: 20px;
  color: var(--gray-700);
  border: none;
  background: none;
}
.screen-header .header-right {
  margin-left: auto;
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 18px;
}
.screen-header .header-right span { cursor: pointer; }

/* ===== Category Tabs ===== */
.cat-tabs {
  display: flex;
  border-bottom: 2px solid var(--gray-200);
  padding: 0 16px;
  flex-shrink: 0;
  background: var(--bg);
  position: sticky;
  top: 48px;
  z-index: 40;
}
.cat-tab {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: all 0.2s;
}
.cat-tab.active {
  color: var(--gray-900);
  border-bottom-color: var(--gray-900);
  font-weight: 600;
}

/* ===== Filter Chips ===== */
.chips {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  overflow-x: auto;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  border: 1px solid var(--gray-300);
  color: var(--gray-600);
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.chip.active {
  background: var(--gray-900);
  color: #fff;
  border-color: var(--gray-900);
}
.chip:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.chip.disabled {
  display: none;
}

/* ===== Buttons ===== */
.btn {
  width: 100%;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}
.btn.primary { background: var(--gray-900); color: #fff; }
.btn.primary:active { background: var(--gray-800); }
.btn.accent { background: var(--accent); color: #fff; }
.btn.accent:active { background: #d63a52; }
.btn.outline { background: transparent; border: 1px solid var(--gray-300); color: var(--gray-700); }
.btn.outline:active { background: var(--gray-50); }
.btn.blue { background: var(--blue); color: #fff; }
.btn:disabled { opacity: 0.5; pointer-events: none; }

/* ===== Input ===== */
.input-field {
  width: 100%;
  height: 48px;
  border: 1px solid var(--gray-300);
  border-radius: 10px;
  padding: 0 14px;
  font-size: 14px;
  background: var(--gray-50);
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}
.input-field:focus { border-color: var(--blue); background: #fff; }
.input-field::placeholder { color: var(--gray-500); }

/* ===== Badge ===== */
.badge {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  display: inline-block;
}
.badge.blue { background: #e7f0ff; color: var(--blue); }
.badge.green { background: #e6fcf0; color: var(--green); }
.badge.red { background: #ffe8e8; color: var(--red); }
.badge.gray { background: var(--gray-100); color: var(--gray-600); }

/* ===== Grid Layouts ===== */
/* 3-column Instagram Explore grid */
.grid-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 2px;
}
/* 2-column grid when category filter is active */
.grid-2col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
  padding: 3px;
}
.grid-2col .grid-item {
  aspect-ratio: 3 / 4;
  background: var(--gray-200);
  position: relative;
  cursor: pointer;
  overflow: hidden;
}
.grid-2col .grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s;
}
.grid-2col .grid-item:active img {
  transform: scale(1.03);
}
.grid-2col .grid-item .overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.2s;
}
.grid-2col .grid-item:hover .overlay,
.grid-2col .grid-item:active .overlay {
  opacity: 1;
}
.grid-2col .grid-item .view-badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  display: flex;
  align-items: center;
  gap: 3px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
  pointer-events: none;
}
.grid-3col .grid-item {
  aspect-ratio: 5 / 7;
  background: var(--gray-200);
  position: relative;
  cursor: pointer;
  overflow: hidden;
}
.grid-3col .grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s;
}
.grid-3col .grid-item:active img {
  transform: scale(1.03);
}
/* Instagram-style overlay: shown on hover/tap, centered view count */
.grid-3col .grid-item .overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.2s;
  letter-spacing: -0.3px;
}
.grid-3col .grid-item:hover .overlay,
.grid-3col .grid-item:active .overlay {
  opacity: 1;
}
/* Always-visible small view count badge (bottom-left) */
.grid-3col .grid-item .view-badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  display: flex;
  align-items: center;
  gap: 3px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
  pointer-events: none;
}
/* Feed heart button */
.feed-heart {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: none;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  padding: 0;
  transition: transform 0.15s;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}
.feed-heart:active {
  transform: scale(1.15);
}

/* 2-column Masonry */
.masonry-grid {
  columns: 2;
  column-gap: 6px;
  padding: 6px;
}
.masonry-item {
  break-inside: avoid;
  margin-bottom: 6px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--gray-100);
  cursor: pointer;
}
.masonry-item .masonry-img {
  width: 100%;
  background: var(--gray-200);
  position: relative;
  overflow: hidden;
}
.masonry-item .masonry-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.masonry-item .masonry-img .overlay {
  position: absolute;
  bottom: 6px;
  left: 6px;
  color: #fff;
  font-size: 9px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
}
.masonry-item .masonry-meta {
  padding: 6px 8px;
}
.masonry-item .masonry-meta .name {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-800);
}
.masonry-item .masonry-meta .location {
  font-size: 9px;
  color: var(--gray-500);
  margin-top: 2px;
}
/* Compact mode: name only, minimal padding */
.masonry-item .masonry-meta--compact {
  padding: 4px 6px;
  background: var(--gray-100);
}
.masonry-item .masonry-meta--compact .name {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== Ranking (RushBoom Store Ranking Style) ===== */

/* Mode Tabs (전체 / 지역 업체) */
.rank-mode-tabs {
  max-width: 520px;
  margin: 0 auto;
  padding: 10px 16px 6px;
  display: flex;
  gap: 6px;
  background: #fff;
}
.rank-mode-tab {
  flex: 1;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500);
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.rank-mode-tab.active {
  color: #fff;
  background: var(--gray-900);
  border-color: var(--gray-900);
}

/* Text-only Card (이미지 없는 업체용 컴팩트 리스트) */
.text-only-list {
  padding: 4px 0;
}
.text-only-card {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background 0.15s;
}
.text-only-card:hover {
  background: var(--gray-50, #fafafa);
}
.text-only-card .text-card-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.text-only-card .store-rank {
  padding-top: 2px;
}
.text-only-card .text-card-main {
  flex: 1;
  min-width: 0;
}
.text-only-card .store-tags-row {
  margin-top: 4px;
}
.text-only-card .store-right {
  margin-left: auto;
}
.text-card-meta {
  margin-top: 8px;
  margin-left: 34px; /* rank 24px + gap 10px 만큼 들여쓰기 */
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.text-card-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--gray-500);
  line-height: 1.4;
}
.text-card-meta-row svg {
  flex-shrink: 0;
  color: var(--gray-400);
}
.text-card-meta-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Main Tabs (업종 탭 — sticky) */
.rank-main-tabs {
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 90;
  border-bottom: 1px solid var(--gray-100);
}
.rank-tabs-scroll {
  display: flex;
  align-items: center;
  max-width: 520px;
  margin: 0 auto;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.rank-tabs-scroll::-webkit-scrollbar { display: none; }
.rank-main-tab {
  flex: 0 0 auto;
  padding: 12px 14px;
  font-size: 13px;
  white-space: nowrap;
  font-weight: 600;
  color: var(--gray-400);
  text-align: center;
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s;
}
.rank-main-tab.active {
  color: var(--gray-900);
  border-bottom-color: var(--gray-900);
}

/* District chips (구/시) */
.rank-districts {
  max-width: 520px;
  margin: 0 auto;
  padding: 8px 16px 0;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.rank-districts::-webkit-scrollbar { display: none; }
.district-chip {
  flex-shrink: 0;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-600);
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.district-chip.active {
  background: var(--gray-900);
  color: #fff;
  border-color: var(--gray-900);
}

/* Controls Row (기간 select) */
.rank-controls {
  max-width: 520px;
  margin: 0 auto;
  padding: 12px 16px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.rank-period-select {
  padding: 7px 28px 7px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
  border: 1px solid var(--gray-200);
  border-radius: 20px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  outline: none;
}

/* Page Info */
.page-info {
  max-width: 520px;
  margin: 0 auto;
  padding: 12px 16px 4px;
  background: #fff;
}
.page-meta {
  font-size: 12px;
  color: var(--gray-500);
}

/* Store List Container */
.store-list {
  max-width: 520px;
  margin: 0 auto;
  background: #fff;
}

/* Store Card */
.store-card {
  background: #fff;
}

/* Store Header */
.store-header {
  display: flex;
  align-items: center;
  padding: 10px 12px 6px;
  gap: 10px;
}
.store-rank {
  flex-shrink: 0;
  font-size: 18px;
  font-weight: 400;
  color: var(--gray-400);
  min-width: 24px;
  text-align: center;
}
.store-rank.top3 {
  font-weight: 800;
  color: var(--gray-600);
}
.store-logo {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  min-width: 52px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  border: 1px solid var(--gray-200);
  display: block;
}
.store-logo-placeholder {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  min-width: 52px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gray-200);
}

/* 관리자 설정: 랭킹 썸네일 모양 정사각 모드
   body[data-thumb-shape] 속성은 /api/settings/ui 응답에 따라 app.js 가 세팅 */
body[data-thumb-shape="square"] .store-logo,
body[data-thumb-shape="square"] .store-logo-placeholder {
  border-radius: 12px;
}
.store-info {
  flex: 1;
  min-width: 0;
}
.store-name-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.store-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.store-desc {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.store-tags-row {
  display: flex;
  gap: 4px;
  margin-top: 3px;
  flex-wrap: wrap;
}
.store-tag-chip {
  font-size: 10px;
  color: var(--gray-600);
  background: var(--gray-100);
  padding: 2px 6px;
  border-radius: 4px;
}
.store-tag-chip.tag-industry {
  color: #4a7bf7;
  background: #e7f0ff;
}
.store-tag-chip.tag-region {
  color: #2d9d5c;
  background: #e6f9ee;
}
.store-tag-chip.tag-specialty {
  color: #e67e22;
  background: #fef5e7;
}
.store-right {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
/* Wishlist heart button */
.wishlist-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  margin: -10px;
  transition: transform 0.2s;
}
.wishlist-btn:hover { transform: scale(1.15); }
.wishlist-btn:active { transform: scale(0.95); }
.wishlist-btn.active svg {
  fill: #ff4757;
  stroke: #ff4757;
}
.wishlist-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  margin-top: 1px;
}

/* Products Area — horizontal scroll */
.products-area {
  position: relative;
  padding-bottom: 8px;
}
.products-scroll {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0;
  gap: 3px;
  cursor: grab;
}
.products-scroll::-webkit-scrollbar { display: none; }

/* gap 3px * 3 = 9px for 4 columns */
.product-card {
  flex: 0 0 calc((100% - 9px) / 4);
  min-width: 0;
  scroll-snap-align: start;
  text-decoration: none;
  color: inherit;
  display: block;
}
.product-card img {
  width: 100%;
  aspect-ratio: 1 / 1.15;
  object-fit: cover;
  display: block;
  background: var(--gray-100);
  -webkit-user-drag: none;
  user-select: none;
}
.product-img-placeholder {
  width: 100%;
  aspect-ratio: 1 / 1.15;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--gray-400);
}

/* More Card */
/* gap 3px * 3 = 9px for 4 columns */
.more-card {
  flex: 0 0 calc((100% - 9px) / 4);
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1.15;
  text-decoration: none;
}
.more-card-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--gray-500);
}
.more-card-circle {
  width: 36px;
  height: 36px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.more-label {
  font-size: 10px;
  font-weight: 500;
}

/* Empty State */
.rank-empty {
  text-align: center;
  padding: 80px 16px;
  color: var(--gray-400);
  background: #fff;
}
.rank-empty-icon { font-size: 32px; margin-bottom: 12px; }
.rank-empty-msg { font-size: 14px; font-weight: 600; color: var(--gray-600); }
.rank-empty-sub { font-size: 12px; color: var(--gray-400); margin-top: 6px; }

/* Rectangular Mode Tabs (전체 / 즐겨찾기) */
.rank-mode-tabs-rect {
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
}
.rank-mode-rect {
  flex: 1;
  padding: 13px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-400);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  text-align: center;
  transition: color 0.2s, border-color 0.2s;
}
.rank-mode-rect.active {
  color: var(--gray-900);
  border-bottom-color: var(--gray-900);
}

/* Region Button (바텀시트 트리거) */
/* 2026-05-20 리뷰 fix — 구/시 칩 행 비활성 후 본 알약이 현재 지역 필터의 유일한 시각 단서.
   배경 토큰 + font-size 14px + 테두리 강화로 가시성 ↑ (페이지 배경과 색 대비 확보). */
.rank-region-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900);
  border: 1px solid var(--gray-300);
  border-radius: 20px;
  background: var(--gray-100);
  cursor: pointer;
  transition: all 0.15s;
}
.rank-region-btn:active {
  background: var(--gray-200);
}

/* Region Bottom Sheet Overlay */
.rbs-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transition: background 0.2s;
}
.rbs-overlay.rbs-visible {
  background: rgba(0, 0, 0, 0.4);
}
.rbs-sheet {
  width: 100%;
  max-width: 430px;
  max-height: 80vh;
  background: #fff;
  border-radius: 16px 16px 0 0;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.25s ease-out;
}
.rbs-overlay.rbs-visible .rbs-sheet {
  transform: translateY(0);
}
.rbs-header {
  display: flex;
  align-items: center;
  padding: 16px 16px 8px;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.rbs-title {
  font-size: 16px;
  font-weight: 700;
}
.rbs-close {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--gray-500);
  cursor: pointer;
  padding: 4px 8px;
}
.rbs-section {
  padding: 4px 0;
}
.rbs-subtitle {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  padding: 8px 16px 0;
}
.rbs-chip {
  cursor: pointer;
}

/* Bookmark button active state */
.bookmark-btn.active svg {
  fill: #ffc107;
  stroke: #ffc107;
}

/* ===== Loading ===== */
.loading-spinner {
  display: flex;
  justify-content: center;
  padding: 60px;
}
.loading-spinner::after {
  content: '';
  width: 28px;
  height: 28px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--gray-600);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Bottom Sheet (Category Filter) ===== */
.bottom-sheet-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.bottom-sheet {
  background: #fff;
  border-radius: 20px 20px 0 0;
  max-width: 430px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.bottom-sheet .handle {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--gray-300);
  margin: 12px auto 16px;
}
.bottom-sheet .sheet-title {
  padding: 0 20px 12px;
  font-size: 17px;
  font-weight: 700;
}
.bottom-sheet .sheet-content {
  overflow-y: auto;
  padding: 0 20px;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}
.bottom-sheet .sheet-footer {
  padding: 16px 20px;
  display: flex;
  gap: 10px;
  border-top: 1px solid var(--gray-200);
  padding-bottom: calc(16px + var(--safe-bottom));
}

/* ===== Utility ===== */
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.text-xs { font-size: 11px; }
.text-sm { font-size: 13px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.px-16 { padding-left: 16px; padding-right: 16px; }
.py-16 { padding-top: 16px; padding-bottom: 16px; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }

/* ===== Fade Animation ===== */
.fade-in { animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ===== Image Placeholder ===== */
.img-placeholder {
  background: var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
  font-size: 24px;
}

/* ===== Splash ===== */
/* 2026-04-29 — 풀스크린 carousel.
   - position: absolute + inset:0 으로 #screen-content (#app 의 430px 폰 프레임 내부) 채움.
   - 브라우저 전체창이 아닌 폰 프레임 비율 안에서 풀스크린.
   - 슬라이드 너비/트랙 너비/transform 은 JS 가 #screen-content.clientWidth 기준 px 로 직접 셋팅
     (vw 는 브라우저 전체 기준이라 폰 프레임에 안 맞음). */
.splash-fullscreen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #0a0a1a;
  color: #fff;
  overflow: hidden;
}
.splash-loading {
  /* fetch 중 빈 검은 화면. branding/carousel 둘 중 하나로 곧바로 교체됨. */
}
.splash-branding {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.splash-brand-logo {
  font-size: 72px;
  margin-bottom: 16px;
  line-height: 1;
}
.splash-brand-name {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}
.splash-brand-slogan {
  font-size: 14px;
  color: #888;
}
.splash-track {
  display: flex;
  height: 100%;
  will-change: transform;
}
.splash-slide {
  flex: 0 0 auto; /* width 는 JS 가 px 로 직접 셋팅 */
  height: 100%;
  background: #0a0a1a;
}
.splash-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.splash-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.splash-dot {
  width: 8px;
  height: 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.4);
  transition: width 200ms ease, background-color 200ms ease;
}
.splash-dot.active {
  width: 22px;
  background: #fff;
}
.splash-skip {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: 16px;
  background: rgba(0,0,0,0.55);
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  border: none;
  color: rgba(255,255,255,0.9);
  z-index: 1;
}
.splash-skip:hover {
  background: rgba(0,0,0,0.7);
}

/* legacy .splash-screen — 다른 곳에서 참조 가능성 보존 (사용처 없으면 다음 cleanup 에서 제거) */
.splash-screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
  color: #fff;
  position: relative;
}

/* ===== Company Detail ===== */
.company-hero {
  width: 100%;
  height: 250px;
  background: linear-gradient(135deg, var(--gray-200), var(--gray-300));
  position: relative;
  overflow: hidden;
}
.company-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.company-hero .hero-track {
  width: 100%;
  height: 100%;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  cursor: grab;
}
.company-hero .hero-track::-webkit-scrollbar { display: none; }
.company-hero .hero-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  user-select: none;
  -webkit-user-drag: none;
}
.company-hero .hero-nav {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}
.company-hero .hero-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  cursor: pointer;
  transition: width 0.2s, background 0.2s;
}
.company-hero .hero-dot.active { background: #fff; width: 18px; border-radius: 3px; }
.company-cta {
  padding: 12px 16px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  gap: 8px;
  background: var(--bg);
  position: sticky;
  bottom: 0;
  z-index: 10;
}

/* Info card (상호/주소/전화번호) */
.info-card {
  background: var(--gray-50, #fafafa);
  border: 1px solid var(--gray-200, #e5e5e5);
  border-radius: 12px;
  padding: 4px 14px;
}
.info-row {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  align-items: flex-start;
}
.info-label {
  width: 64px;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--gray-500, #888);
  padding-top: 2px;
}
.info-value {
  flex: 1;
  font-size: 14px;
  color: var(--gray-900, #222);
  line-height: 1.5;
  word-break: break-all;
}
.info-value-wrap {
  flex: 1;
  min-width: 0;
}
.info-value-wrap .info-value { width: 100%; }
.info-divider {
  height: 1px;
  background: var(--gray-200, #eee);
}
.info-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--gray-300, #d4d4d4);
  color: var(--gray-700, #555);
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
}
.info-action:hover { background: var(--gray-100, #f5f5f5); }
.info-action.call { color: #40c057; border-color: rgba(64,192,87,0.35); }

/* 지역 체인 (지역 › 구) */
.region-chain {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}
.region-chip {
  padding: 2px 8px;
  background: rgba(74, 123, 247, 0.1);
  border: 1px solid rgba(74, 123, 247, 0.3);
  border-radius: 10px;
  font-size: 11px;
  color: #4a7bf7;
  font-weight: 500;
}
.region-sep { color: var(--gray-400, #aaa); font-size: 12px; }

/* ===== Empty State ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--gray-500);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state .msg { font-size: 14px; }

/* ===== Menu Item ===== */
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background 0.15s;
}
.menu-item:active { background: var(--gray-50); }
.menu-item .icon { font-size: 18px; width: 24px; text-align: center; }
.menu-item .label { font-size: 14px; flex: 1; }
.menu-item .arrow { color: var(--gray-400); font-size: 14px; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: calc(var(--tab-height) + 16px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-900);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 1000;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2s forwards;
}
@keyframes toastIn { from { opacity:0; transform:translateX(-50%) translateY(20px); } }
@keyframes toastOut { to { opacity:0; transform:translateX(-50%) translateY(20px); } }

/* ===== Legal Content (Terms, Privacy) ===== */
.legal-content {
  padding: 20px 16px 40px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--gray-700);
}
.legal-content h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 24px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--gray-100);
}
.legal-content p {
  margin-bottom: 12px;
}
.legal-content strong {
  font-weight: 600;
  color: var(--gray-800);
}
.legal-updated {
  display: inline-block;
  background: var(--gray-50);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  color: var(--gray-500);
  margin-bottom: 16px;
}
.legal-footer {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-200);
  font-size: 11px;
  color: var(--gray-500);
  line-height: 1.8;
}

/* ===== AI History ===== */
.ai-history-item {
  background: var(--gray-50);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
}
.ai-history-images {
  display: flex;
  gap: 2px;
}
.ai-history-img {
  flex: 1;
  aspect-ratio: 1;
  background: var(--gray-200);
  position: relative;
  overflow: hidden;
}
.ai-history-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ai-history-label {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
}
.ai-history-meta {
  padding: 10px 12px;
}

/* ===== FAQ ===== */
.faq-item {
  border-bottom: 1px solid var(--gray-100);
}
.faq-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--gray-800);
}
.faq-arrow {
  font-size: 10px;
  color: var(--gray-400);
  transition: transform 0.2s;
}
.faq-a {
  padding: 0 0 14px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--gray-600);
}

/* ===== Recent Views ===== */
.rv-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}
.rv-item:active { background: var(--gray-50); }
.rv-avatar {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: var(--gray-200);
  flex-shrink: 0;
  overflow: hidden;
}
.rv-avatar img { width: 100%; height: 100%; object-fit: cover; }
.rv-info { flex: 1; min-width: 0; }
.rv-name { font-size: 14px; font-weight: 600; color: var(--gray-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-addr { font-size: 12px; color: var(--gray-500); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-time { font-size: 10px; color: var(--gray-400); margin-top: 3px; }
.rv-del {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 6px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.15s;
}
.rv-del:active { background: var(--gray-100); color: var(--red); }

/* ===== Consultation Modal ===== */
.cm-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(15, 17, 23, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: cm-fade 0.2s ease-out;
}
@keyframes cm-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cm-slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.cm-sheet {
  width: 100%; max-width: 430px;
  max-height: 92vh;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 8px 20px calc(20px + var(--safe-bottom));
  animation: cm-slide-up 0.28s cubic-bezier(0.2, 0.85, 0.3, 1);
  /* slim scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.18) transparent;
}
.cm-sheet::-webkit-scrollbar { width: 6px; }
.cm-sheet::-webkit-scrollbar-track { background: transparent; }
.cm-sheet::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}
.cm-sheet::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.28); }

/* 상단 드래그 핸들 */
.cm-handle {
  width: 36px; height: 4px;
  background: var(--gray-300);
  border-radius: 2px;
  margin: 0 auto 6px;
}

.cm-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0 10px;
  position: sticky; top: 0; background: var(--bg); z-index: 5;
  border-bottom: 1px solid var(--gray-100);
}
.cm-title { font-size: 18px; font-weight: 700; color: var(--gray-900); letter-spacing: -0.01em; }
.cm-close {
  background: var(--gray-50); border: none;
  width: 32px; height: 32px; border-radius: 50%;
  color: var(--gray-600); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.cm-close:hover { background: var(--gray-100); color: var(--gray-800); }
.cm-close:active { transform: scale(0.94); }

.cm-company {
  font-size: 13px; color: var(--gray-600);
  padding: 12px 0 14px;
  border-bottom: 1px solid var(--gray-100);
  margin-bottom: 14px;
}

.cm-form { display: flex; flex-direction: column; gap: 4px; }
.cm-label {
  font-size: 13px; font-weight: 600; color: var(--gray-700);
  margin-top: 12px; margin-bottom: 6px;
}
.cm-req { color: var(--accent); }

.cm-input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  font-size: 14px;
  background: var(--bg-secondary);
  color: var(--gray-900);
  -webkit-appearance: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.cm-input:hover { border-color: var(--gray-300); }
.cm-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg);
  box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.12);
}
.cm-textarea {
  height: 96px; padding: 12px 14px;
  resize: vertical; font-family: inherit;
  line-height: 1.5;
}

.cm-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* 라디오 (주거 / 상업) */
.cm-radio-group { display: flex; gap: 10px; margin-top: 4px; }
.cm-radio {
  flex: 1; display: flex; align-items: center; justify-content: center;
  height: 46px;
  border: 1px solid var(--gray-200); border-radius: 10px;
  font-size: 14px; color: var(--gray-700); cursor: pointer;
  background: var(--bg-secondary);
  transition: all 0.15s;
  position: relative;
}
.cm-radio input { position: absolute; opacity: 0; pointer-events: none; }
.cm-radio:hover { border-color: var(--gray-300); }
.cm-radio:has(input:checked) {
  border-color: var(--accent);
  background: rgba(233, 69, 96, 0.07);
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.08);
}

/* ===== 커스텀 Dropdown ===== */
.cm-dd {
  position: relative;
  width: 100%;
}
.cm-dd-trigger {
  width: 100%;
  height: 46px;
  padding: 0 12px 0 14px;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  background: var(--bg-secondary);
  color: var(--gray-900);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  text-align: left;
}
.cm-dd-trigger:hover:not(:disabled) { border-color: var(--gray-300); }
.cm-dd.is-open .cm-dd-trigger {
  border-color: var(--accent);
  background: var(--bg);
  box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.12);
}
.cm-dd.is-disabled .cm-dd-trigger {
  background: var(--gray-100);
  color: var(--gray-400);
  cursor: not-allowed;
  opacity: 0.7;
}
.cm-dd-value {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cm-dd-value.is-placeholder { color: var(--gray-500); font-weight: 400; }
.cm-dd-value:not(.is-placeholder) { color: var(--gray-900); font-weight: 500; }
.cm-chev {
  flex-shrink: 0;
  margin-left: 8px;
  color: var(--gray-500);
  transition: transform 0.2s ease, color 0.15s;
}
.cm-dd.is-open .cm-chev { transform: rotate(180deg); color: var(--accent); }

.cm-dd-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--bg);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
  max-height: 240px;
  overflow-y: auto;
  z-index: 10;
  padding: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.18) transparent;
  animation: cm-dd-pop 0.15s ease-out;
}
@keyframes cm-dd-pop {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cm-dd-list::-webkit-scrollbar { width: 6px; }
.cm-dd-list::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }
.cm-dd-list::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.28); }
.cm-dd-list[hidden] { display: none; }

.cm-opt {
  padding: 10px 12px;
  font-size: 14px;
  color: var(--gray-800);
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  user-select: none;
}
.cm-opt:hover { background: var(--gray-50); }
.cm-opt.is-selected {
  background: rgba(233, 69, 96, 0.08);
  color: var(--accent);
  font-weight: 600;
}
.cm-opt.is-selected:hover { background: rgba(233, 69, 96, 0.12); }

/* 동의 체크박스 — 커스텀 마크 */
.cm-agree {
  display: flex; align-items: flex-start; gap: 10px;
  margin-top: 18px;
  padding: 12px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  font-size: 13px; color: var(--gray-700);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.cm-agree:hover { border-color: var(--gray-300); }
.cm-agree input { position: absolute; opacity: 0; pointer-events: none; }
.cm-agree-mark {
  flex-shrink: 0;
  width: 18px; height: 18px;
  border: 1.5px solid var(--gray-400);
  border-radius: 4px;
  margin-top: 1px;
  position: relative;
  transition: all 0.15s;
}
.cm-agree input:checked + .cm-agree-mark {
  background: var(--accent);
  border-color: var(--accent);
}
.cm-agree input:checked + .cm-agree-mark::after {
  content: '';
  position: absolute;
  left: 5px; top: 1px;
  width: 5px; height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.cm-agree-text { flex: 1; line-height: 1.5; }
.cm-agree-text a { color: var(--accent); text-decoration: underline; }

.cm-error {
  margin-top: 14px;
  padding: 12px 14px;
  background: rgba(250, 82, 82, 0.08);
  color: var(--red);
  border: 1px solid rgba(250, 82, 82, 0.18);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.4;
}

.cm-submit {
  margin-top: 18px;
  height: 52px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px; font-weight: 700; letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(233, 69, 96, 0.25);
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
}
.cm-submit:hover:not(:disabled) {
  background: var(--accent-light);
  box-shadow: 0 6px 18px rgba(233, 69, 96, 0.32);
}
.cm-submit:active:not(:disabled) { transform: translateY(1px); }
.cm-submit:disabled {
  background: var(--gray-300);
  cursor: not-allowed;
  box-shadow: none;
}

/* ===== Lightbox Modal ===== */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: lightbox-fade-in 0.2s ease;
}
@keyframes lightbox-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.lightbox-img {
  /* 가로 풀폭 + 세로는 이미지 비율대로 (사용자 요구: 좌우 margin 제거).
     viewport 보다 세로가 긴 사진은 flex 부모(`.lightbox-overlay`)의 center 정렬로 위/아래가 잘릴 수 있음. */
  width: 100%;
  height: auto;
  border-radius: 4px;
  user-select: none;
  -webkit-user-drag: none;
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 10;
}
.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
}
.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 10;
}
.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }
.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255, 255, 255, 0.3);
}
.lightbox-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 1px;
  max-width: 80vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lightbox-counter-name {
  letter-spacing: 0;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  font-size: 14px;
}
/* boundary 도달 + fetch 진행 중 — 사용자에게 클릭 반응 시각화.
   opacity 0.5 → 0.7 약화: "잠금" 인지 약화 (close/prev 와의 시각 격차 줄여
   사용자가 lightbox 전체가 멈춘 것처럼 오인식하는 회귀 방지). */
.lightbox-overlay.lightbox-waiting .lightbox-next {
  opacity: 0.7;
  position: relative;
}
.lightbox-overlay.lightbox-waiting .lightbox-next::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 18px; height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: lightbox-spin 0.7s linear infinite;
}
@keyframes lightbox-spin {
  to { transform: rotate(360deg); }
}

/* =========================================================
   Desktop Layout (≥ 901px)
   왼쪽 hero 안내 + 오른쪽 폰 프레임(#app, 480px) 2-column 중앙 정렬.
   모바일(< 901px)에서는 #desktop-hero 숨김 + #app 기존 동작 그대로.
   ========================================================= */
#desktop-hero { display: none; }

@media (min-width: 901px) {
  html, body {
    height: 100%;
    overflow: hidden;
    background: linear-gradient(180deg, #f8f9fa 0%, #eef0f3 100%);
  }
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 48px;
    padding: 40px 24px;
  }

  #desktop-hero {
    display: block;
    flex: 0 0 auto;
    max-width: 480px;
    color: var(--gray-800);
  }
  .desktop-hero-inner {
    display: flex;
    flex-direction: column;
    gap: 24px;
  }
  #desktop-hero .hero-badge {
    display: inline-flex;
    align-self: flex-start;
    align-items: center;
    padding: 6px 14px;
    border: 1px solid rgba(233, 69, 96, 0.3);
    border-radius: 100px;
    background: rgba(233, 69, 96, 0.08);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
  }
  #desktop-hero .hero-title {
    font-size: 44px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.5px;
    color: var(--gray-900);
  }
  #desktop-hero .hero-title .accent { color: var(--accent); }
  #desktop-hero .hero-desc {
    font-size: 17px;
    line-height: 1.6;
    color: var(--gray-600);
  }
  #desktop-hero .hero-features {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 4px;
  }
  #desktop-hero .hero-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    color: var(--gray-700);
  }
  #desktop-hero .feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(233, 69, 96, 0.1);
    color: var(--accent);
    flex-shrink: 0;
  }
  #desktop-hero .hero-stores {
    display: flex;
    gap: 12px;
    margin-top: 12px;
  }
  #desktop-hero .store-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: 12px;
    background: var(--gray-900);
    color: #fff;
    text-decoration: none;
    cursor: default;
    opacity: 0.88;
  }
  #desktop-hero .store-btn-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    text-align: left;
  }
  #desktop-hero .store-btn-sub { font-size: 10px; opacity: 0.7; }
  #desktop-hero .store-btn-name { font-size: 15px; font-weight: 600; }

  /* 폰 프레임 — 데스크탑에서만 살짝 넓힘 (430 → 450px) + 자연 폰 룩 */
  #app {
    flex: 0 0 450px;
    max-width: 450px;
    margin: 0;
    height: min(880px, calc(100vh - 80px));
    max-height: calc(100vh - 80px);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.04);
  }
}
.lightbox-overlay.lightbox-waiting .lightbox-next svg {
  visibility: hidden;
}
.lightbox-img {
  touch-action: pan-y;
  will-change: transform;
  -webkit-user-drag: none;
  cursor: grab; /* 데스크톱: 드래그 가능함을 시각적으로 안내 */
}
.lightbox-img.dragging {
  cursor: grabbing;
}
.lightbox-placeholder {
  width: 60vw;
  max-width: 320px;
  height: 40vh;
  max-height: 240px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 13px;
}
.lightbox-actions {
  position: absolute;
  bottom: 48px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;           /* 좁은 폰에서 2개 버튼이 못 들어가면 세로로 쌓음 */
  justify-content: center;
  gap: 10px;
  z-index: 10;
  max-width: calc(100vw - 24px); /* 화면 바깥 삐져나감 방지 */
}
.lightbox-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background 0.15s;
  white-space: nowrap;      /* 버튼 전체 레벨에서도 한 번 더 안전장치 */
  flex-shrink: 0;           /* wrap 이 일어나더라도 버튼 내부는 줄바꿈 금지 */
}
.lightbox-action:hover { background: rgba(255, 255, 255, 0.28); }
.lightbox-action-supplier { background: rgba(255, 71, 87, 0.85); }
.lightbox-action-supplier:hover { background: rgba(255, 71, 87, 1); }
.lightbox-action span {
  line-height: 1;
  white-space: nowrap;      /* "공급사 바로가기" 가 "공급사/바로가기" 로 줄바꿈 되지 않도록 */
}
