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

:root {
  --primary: #FF4B6E;
  --primary-light: #FF7A94;
  --secondary: #5B6CF9;
  --bg: #F8F9FC;
  --card: #FFFFFF;
  --text: #1A1A2E;
  --text-sub: #6B7280;
  --border: #E5E7EB;
  --ichibar: #FF4B6E;
  --jiche: #5B6CF9;
  --new: #10B981;
  --mixed: #F59E0B;
}

html {
  height: 100%;
  overflow: hidden; /* body 레벨 스크롤 방지 */
}

body {
  height: 100%;
  background: var(--bg);
  font-family: -apple-system, 'Pretendard', 'Apple SD Gothic Neo', sans-serif;
  overscroll-behavior: none;
  overflow: hidden; /* PC에서 body 스크롤로 footer 사라지는 현상 방지 */
}

/* 반응형 앱 컨테이너 */
#app {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  overscroll-behavior: none;
  touch-action: manipulation; /* 더블탭 확대/축소 방지 */
}

/* Pages */
.page {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;   /* flex shrink 허용 — bottom-nav 밀림 방지 */
  min-width: 0;
  overflow: hidden;
}
.page.active { display: flex; }

/* Page Header */
.page-header {
  background: var(--card);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.page-header h2 { font-size: 18px; font-weight: 700; color: var(--text); }
.logo {
  display: flex; align-items: center; gap: 8px;
  font-size: 0; /* SVG + span으로 구성 */
}
.logo-text {
  font-size: 20px; font-weight: 700;
  font-family: 'Cinzel', Georgia, serif;
  color: #D4213A; letter-spacing: 3px; line-height: 1;
}
.icon-btn {
  background: none; border: none; font-size: 22px; cursor: pointer;
  position: relative;
}
.badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--primary); color: white;
  font-size: 9px; font-weight: 700; min-width: 16px; height: 16px;
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}
.text-btn {
  background: none; border: none; color: var(--primary);
  font-size: 15px; font-weight: 600; cursor: pointer;
}

/* Map Page */
/* ③ 검색바 기본 숨김 — 돋보기 클릭 시 노출 */
.map-search {
  padding: 10px 16px;
  background: var(--card);
  display: none;          /* 기본 숨김 */
  gap: 8px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  position: relative;     /* 드롭다운 기준점 */
}
.map-search.show { display: flex; }

/* 지도 검색 추천 드롭다운 — #app 직계 자식, JS로 좌표 설정 */
.map-search-dropdown {
  display: none;
  position: absolute;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 14px 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  max-height: 320px;
  overflow-y: auto;
  z-index: 600;
}
.map-search-dropdown.open { display: block; }
.map-ssi {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.map-ssi:last-child { border-bottom: none; }
.map-ssi:active { background: var(--bg); }
.map-ssi-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 2px;
}
.map-ssi-name { font-size: 14px; font-weight: 700; color: var(--text); }
.map-ssi-remaining { font-size: 12px; font-weight: 700; flex-shrink: 0; }
.map-ssi-remaining.avail { color: #10B981; }
.map-ssi-remaining.sold  { color: #EF4444; }
.map-ssi-addr { font-size: 11px; color: var(--text-sub); margin-bottom: 4px; }
.map-ssi-types { display: flex; gap: 4px; flex-wrap: wrap; }

/* 헤더 우측 버튼 그룹 */
.header-right {
  display: flex; align-items: center; gap: 4px;
}
.search-toggle-btn { color: var(--text); }
.search-toggle-btn.active { color: var(--primary); }
.search-input-wrap {
  flex: 1; display: flex; align-items: center;
  background: var(--bg); border-radius: 10px; padding: 8px 12px; gap: 8px;
}
.search-icon { font-size: 14px; }
.map-search-input {
  border: none; background: none; outline: none;
  font-size: 14px; color: var(--text); width: 100%;
}
.filter-btn {
  background: var(--primary); color: white;
  border: none; border-radius: 10px; padding: 0 14px;
  font-size: 13px; font-weight: 600; cursor: pointer;
}

.map-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  touch-action: pan-x pan-y pinch-zoom; /* 지도 자체 터치: 드래그·핀치줌 허용 */
}

.map-bg {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #E8F4F0 0%, #EEF2FF 50%, #FEF3F2 100%);
  position: relative;
}

.map-roads {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
}

/* Map Pins */
.map-pin {
  position: absolute;
  transform: translate(-50%, -100%);
  cursor: pointer;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.2s;
}
.map-pin:hover { transform: translate(-50%, -110%); }

.pin {
  background: var(--ichibar);
  color: white; font-size: 10px; font-weight: 700;
  padding: 3px 8px; border-radius: 10px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(255,75,110,0.4);
}
.pin.secondary { background: var(--jiche); box-shadow: 0 2px 8px rgba(91,108,249,0.4); }
.pin.mixed { background: var(--mixed); box-shadow: 0 2px 8px rgba(245,158,11,0.4); }
.pin.new { background: var(--new); box-shadow: 0 2px 8px rgba(16,185,129,0.4); animation: pulse 1.5s infinite; }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.pin-dot {
  width: 8px; height: 8px;
  background: var(--ichibar); border-radius: 50%;
  margin-top: 2px;
}
.pin-dot.secondary { background: var(--jiche); }
.pin-dot.mixed { background: var(--mixed); }
.pin-dot.new-dot { background: var(--new); }

/* My Location */
.my-location {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 11;
}
.location-pulse {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 40px; height: 40px;
  background: rgba(91,108,249,0.2);
  border-radius: 50%;
  animation: locationPulse 2s infinite;
}
@keyframes locationPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  50% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}
.location-dot { font-size: 24px; position: relative; z-index: 1; }

/* Map Controls */
.map-controls {
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 4px;
}
.map-ctrl-btn {
  width: 36px; height: 36px;
  background: white; border: 1px solid var(--border);
  border-radius: 8px; font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  color: var(--text);
}

/* Map Legend */
.map-legend {
  position: absolute; bottom: 12px; left: 12px;
  background: rgba(255,255,255,0.92);
  border-radius: 10px; padding: 6px 10px;
  display: flex; gap: 10px; font-size: 10px; color: var(--text-sub);
}
.legend-item { display: flex; align-items: center; gap: 4px; }
.legend-dot {
  width: 8px; height: 8px; border-radius: 50%;
}
.legend-dot.ichibar { background: var(--ichibar); }
.legend-dot.jiche { background: var(--jiche); }
.legend-dot.mixed-l { background: var(--mixed); }
.legend-dot.new-l { background: var(--new); }
.legend-dot.closed-l { background: #9CA3AF; }

/* Bottom Preview */
/* ② bottom-preview: 기본 접힘 — 핸들/지도 클릭 시 확장 */
.bottom-preview {
  background: var(--card);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  flex-shrink: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.32,0.72,0,1);
  max-height: 48px;   /* 접힘: 핸들바만 보임 */
}
.bottom-preview.expanded {
  max-height: 220px;  /* 펼침: 카드 표시 */
}
.bottom-preview-handle {
  width: 44px; height: 4px;
  background: var(--border); border-radius: 2px;
  margin: 10px auto 6px;
  cursor: pointer;
}
/* 핸들 탭 영역 확장 */
.preview-handle-tap {
  padding: 0 0 6px;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 0;
}
.preview-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; margin-bottom: 10px;
}
.preview-title {
  font-size: 13px; font-weight: 600; color: var(--text-sub);
}
.preview-arrows {
  display: none; /* 모바일 숨김 */
  gap: 6px;
}
.preview-arrow {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.preview-arrow:hover { background: var(--primary); color: white; border-color: var(--primary); }

/* 매장 검색 */
.store-search-wrap {
  position: relative;
}
.store-search-input {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 14px; color: var(--text); background: var(--bg);
  outline: none; transition: border-color .15s;
}
.store-search-input:focus { border-color: var(--primary); }
.store-search-dropdown {
  display: none;
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--card);
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  z-index: 50; max-height: 200px; overflow-y: auto;
}
.store-search-dropdown.open { display: block; }
.store-search-item {
  padding: 11px 14px; font-size: 14px; cursor: pointer;
  color: var(--text); border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px;
}
.store-search-item:last-child { border-bottom: none; }
.store-search-item:hover { background: var(--bg); }
.store-search-item .ssi-name { font-weight: 600; }
.store-search-item .ssi-addr { font-size: 11px; color: var(--text-sub); }
.store-search-empty { padding: 16px; font-size: 13px; color: var(--text-sub); text-align: center; }
.store-selected-chip {
  margin-top: 8px; padding: 8px 12px;
  background: rgba(212,33,58,0.08); border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--primary);
  display: flex; align-items: center; justify-content: space-between;
}
.store-selected-chip button {
  background: none; border: none; color: var(--text-sub);
  font-size: 16px; cursor: pointer; padding: 0 2px; line-height: 1;
}
.store-list-horizontal {
  display: flex; gap: 10px;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.store-list-horizontal::-webkit-scrollbar { display: none; }
.store-card {
  min-width: 110px;
  background: var(--bg); border-radius: 12px;
  padding: 10px; cursor: pointer;
  border: 1px solid var(--border);
  transition: all 0.2s;
}
.store-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.store-card-img { font-size: 24px; margin-bottom: 6px; }
.store-card-name { font-size: 11px; font-weight: 600; color: var(--text); margin-bottom: 4px; line-height: 1.3; }
.store-card-tags { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 4px; }
.store-card-dist { font-size: 10px; color: var(--text-sub); }
.tag {
  background: #FEE2E2; color: var(--ichibar);
  font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 4px;
}
.tag.jiche { background: #EEF2FF; color: var(--jiche); }

/* Bottom Nav */
.bottom-nav {
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  padding: 8px 0 max(12px, env(safe-area-inset-bottom));
  flex-shrink: 0;
  z-index: 100;
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 3px;
  background: none; border: none; cursor: pointer;
  padding: 4px 0;
}
.nav-icon { font-size: 22px; }
.nav-label {
  font-size: 10px; color: var(--text-sub); font-weight: 500;
  position: relative;
}
.nav-btn.active .nav-icon { filter: none; }
.nav-btn.active .nav-label { color: var(--primary); font-weight: 700; }
.register-nav .register-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--primary), #FF7A45);
  border-radius: 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: white; font-style: normal;
  box-shadow: 0 4px 16px rgba(255,75,110,0.4);
  margin-top: -18px;
}
.nav-badge {
  position: absolute; top: -6px; right: -8px;
  background: var(--primary); color: white;
  font-size: 8px; font-weight: 700;
  min-width: 14px; height: 14px;
  border-radius: 7px; display: inline-flex;
  align-items: center; justify-content: center;
  padding: 0 3px;
}

/* Search Page */
.search-page-body {
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column;
}
.search-bar-main {
  margin: 14px 16px 0;
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: 12px; padding: 10px 14px;
  display: flex; gap: 10px; align-items: center;
}
.search-bar-main input {
  border: none; outline: none; flex: 1;
  font-size: 14px; color: var(--text);
}

.category-tabs {
  display: flex; gap: 6px;
  padding: 12px 16px;
  overflow-x: auto; scrollbar-width: none;
}
.category-tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 6px 14px; border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--card); color: var(--text-sub);
  font-size: 13px; font-weight: 500; cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.tab.active {
  background: var(--primary); border-color: var(--primary);
  color: white; font-weight: 700;
}

.kuji-list {
  flex: 1; overflow-y: auto;
  padding: 0 16px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.kuji-item {
  background: var(--card); border-radius: 14px;
  padding: 12px; display: flex; gap: 12px;
  cursor: pointer; border: 1.5px solid var(--border);
  transition: all 0.2s;
}
.kuji-item:hover { border-color: var(--primary); transform: translateY(-1px); }
.kuji-img { font-size: 32px; flex-shrink: 0; }
.kuji-info { flex: 1; min-width: 0; }
.kuji-name { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.kuji-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; flex-wrap: wrap; }
.badge-tag {
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 6px;
}
.badge-tag.ichibar { background: #FEE2E2; color: var(--ichibar); }
.badge-tag.jiche { background: #EEF2FF; color: var(--jiche); }
.badge-tag.new-badge { background: #D1FAE5; color: var(--new); }
.kuji-price { font-size: 11px; color: var(--text-sub); }
.kuji-prizes { font-size: 11px; color: var(--text-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kuji-stores { font-size: 11px; font-weight: 600; color: var(--primary); flex-shrink: 0; }

/* Register Page */
.register-body {
  flex: 1; overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 16px;
}
.register-section {
  background: var(--card); border-radius: 16px;
  padding: 16px; border: 1px solid var(--border);
}
.section-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 12px; }

.photo-upload-area {
  border: 2px dashed var(--primary-light);
  border-radius: 14px; padding: 28px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer; background: #FFF5F7;
  transition: all 0.2s;
}
.photo-upload-area:hover { background: #FEE2E2; }
.upload-icon { font-size: 36px; }
.upload-text { font-size: 14px; font-weight: 600; color: var(--text); }
.upload-sub { font-size: 12px; color: var(--text-sub); }

.ai-result {
  margin-top: 14px; border: 1.5px solid #10B981;
  border-radius: 12px; padding: 12px; background: #F0FDF4;
}
.ai-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ai-badge { background: #10B981; color: white; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; }
.ai-confidence { font-size: 12px; color: #059669; font-weight: 600; }
.ai-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
/* 등급별 잔여 수량 입력 리스트 (AI결과 + 직접입력 공통) */
.prize-count-list { display: flex; flex-direction: column; }
.prize-count-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 2px; border-bottom: 1px solid var(--border);
}
.prize-count-row:last-child { border-bottom: none; }
.prize-count-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.prize-count-grade { font-size: 12px; font-weight: 800; color: var(--primary); }
.prize-count-name { font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prize-count-stepper { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: 12px; }
.prize-count-stepper button {
  width: 26px; height: 26px; border-radius: 13px;
  border: 1.5px solid var(--border); background: var(--bg);
  font-size: 16px; cursor: pointer; color: var(--text);
  display: flex; align-items: center; justify-content: center; line-height: 1;
}
.prize-count-val { font-size: 15px; font-weight: 700; min-width: 32px; text-align: center; color: var(--text); }
.prize-sold-badge { font-size: 11px; color: #EF4444; font-weight: 700; background: #FEE2E2; padding: 2px 6px; border-radius: 5px; }
.prize-total-row {
  display: flex; justify-content: flex-end; align-items: center; gap: 6px;
  padding: 10px 2px 4px; border-top: 1.5px solid var(--border); margin-top: 4px;
  font-size: 13px; color: var(--text-sub);
}
.prize-total-val { font-size: 20px; font-weight: 800; color: var(--text); }
.ai-note { font-size: 11px; color: var(--text-sub); font-style: italic; margin-top: 8px; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-sub); margin-bottom: 6px; }
/* 커스텀 셀렉트 (native select 대체) */
.custom-select { position: relative; }
.cs-trigger {
  width: 100%; padding: 10px 12px;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 14px; color: var(--text); background: var(--bg);
  cursor: pointer; display: flex; align-items: center;
  justify-content: space-between; gap: 8px; user-select: none;
}
.cs-trigger:active { border-color: var(--primary); }
.cs-text {
  flex: 1; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.cs-chevron {
  font-size: 12px; color: var(--text-sub);
  flex-shrink: 0; transition: transform 0.2s;
}
.custom-select.open .cs-chevron { transform: rotate(180deg); }

/* 드롭다운 패널 — #app에 직접 붙여 overflow:hidden 밖으로 안 튀어나오게 */
.cs-panel {
  position: absolute;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.14);
  overflow-y: auto;
  max-height: 200px;
  z-index: 500;
}
.cs-opt {
  padding: 12px 14px;
  font-size: 14px; color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cs-opt:last-child { border-bottom: none; }
.cs-opt:active, .cs-opt.selected { background: #FFF5F7; color: var(--primary); font-weight: 600; }
.cs-opt.placeholder { color: var(--text-sub); }
/* prize-checklist / number-input — 알림설정 등 다른 곳에서 쓰는 체크리스트 스타일 유지 */
.prize-checklist { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.prize-check {
  display: flex; align-items: center; gap: 5px;
  font-size: 13px; color: var(--text); cursor: pointer;
  background: var(--bg); padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--border);
}

.submit-btn {
  width: 100%; padding: 14px;
  background: linear-gradient(135deg, var(--primary), #FF7A45);
  color: white; border: none; border-radius: 14px;
  font-size: 16px; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 16px rgba(255,75,110,0.35);
  transition: all 0.2s;
}
.submit-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(255,75,110,0.45); }
.submit-btn:active { transform: translateY(0); }

/* Alert Page 탭 */
.alert-tabs {
  display: flex; flex-shrink: 0;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.alert-tab {
  flex: 1; padding: 12px 4px;
  background: none; border: none; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--text-sub);
  border-bottom: 2.5px solid transparent;
  transition: all 0.2s; position: relative;
  display: flex; align-items: center; justify-content: center; gap: 4px;
}
.alert-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.alert-tab-badge {
  background: var(--primary); color: white;
  font-size: 9px; font-weight: 800;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 4px;
}

.alert-tab-pane {
  display: none; flex: 1; overflow: hidden;
  flex-direction: column;
}
.alert-tab-pane.active { display: flex; }
.alert-scroll {
  flex: 1; overflow-y: auto; padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  overscroll-behavior: contain;
}

/* 내 알림 탭 하단 추가 버튼 */
.alert-add-row {
  width: 100%; padding: 13px;
  background: none; border: 1.5px dashed var(--border);
  border-radius: 14px; color: var(--text-sub);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all 0.2s;
}
.alert-add-row:active { background: var(--bg); border-color: var(--primary); color: var(--primary); }

/* Alert Page */
.alert-section { display: flex; flex-direction: column; gap: 10px; }
.alert-section-title { font-size: 13px; font-weight: 700; color: var(--text-sub); text-transform: uppercase; letter-spacing: 0.5px; }

.alert-card {
  background: var(--card); border-radius: 14px;
  padding: 14px; display: flex; align-items: center; gap: 12px;
  border: 1.5px solid var(--border);
}
.alert-card.active-alert { border-color: #FEE2E2; }
.alert-icon { font-size: 28px; }
.alert-info { flex: 1; min-width: 0; }
.alert-name { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.alert-desc { font-size: 11px; color: var(--text-sub); margin-bottom: 2px; }
.alert-meta { font-size: 10px; color: var(--primary); }

/* Toggle */
.toggle { position: relative; display: inline-block; width: 44px; height: 26px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #D1D5DB; border-radius: 13px;
  transition: 0.3s;
}
.slider:before {
  content: ''; position: absolute;
  width: 20px; height: 20px; left: 3px; bottom: 3px;
  background: white; border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
input:checked + .slider { background: var(--primary); }
input:checked + .slider:before { transform: translateX(18px); }

/* Release Cards */
.release-card {
  background: var(--card); border-radius: 14px;
  padding: 14px; display: flex; align-items: center; gap: 12px;
  border: 1.5px solid var(--border);
}
.release-img { font-size: 32px; }
.release-info { flex: 1; }
.release-name { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.release-date { font-size: 12px; color: var(--secondary); font-weight: 600; margin-bottom: 2px; }
.release-price { font-size: 11px; color: var(--text-sub); }
.alert-set-btn {
  background: none; border: 1.5px solid var(--border);
  border-radius: 10px; padding: 6px 10px; font-size: 16px;
  cursor: pointer; transition: all 0.2s;
}
.alert-set-btn.active { background: #FEE2E2; border-color: var(--primary); }

/* Notification Items */
.notif-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--border);
}
.notif-item.unread { background: #FFF5F7; border-color: #FEE2E2; }
.notif-icon { font-size: 22px; flex-shrink: 0; }
.notif-text { flex: 1; font-size: 12px; color: var(--text); line-height: 1.5; }
.notif-time { font-size: 10px; color: var(--text-sub); flex-shrink: 0; }

/* Alert Type Buttons */
.alert-type-select { display: flex; gap: 6px; flex-wrap: wrap; }
.alert-type-btn {
  padding: 7px 12px; border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--bg); color: var(--text-sub);
  font-size: 12px; font-weight: 500; cursor: pointer;
}
.alert-type-btn.active {
  background: var(--primary); border-color: var(--primary);
  color: white; font-weight: 700;
}

/* Modals */
.modal-overlay {
  display: none;
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 600;
}
.modal-overlay.show { display: block; }

.modal {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--card);
  border-top-left-radius: 24px; border-top-right-radius: 24px;
  z-index: 601;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32,0.72,0,1),
              visibility 0s linear 0.35s;
  max-height: 75%;
  display: flex; flex-direction: column;
  visibility: hidden;   /* transform만으로 안 숨겨지는 케이스 방지 */
  pointer-events: none; /* 숨겨진 상태에서 클릭 차단 */
}
.modal.show {
  transform: translateY(0);
  visibility: visible;
  pointer-events: auto;
  transition: transform 0.35s cubic-bezier(0.32,0.72,0,1),
              visibility 0s linear 0s;
}
.modal-handle {
  width: 36px; height: 4px;
  background: var(--border); border-radius: 2px;
  margin: 12px auto 0;
  flex-shrink: 0;
}
.modal-content {
  padding: 14px 20px 30px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.modal-content h3 { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 16px; }

/* Filter */
.filter-group { margin-bottom: 18px; }
.filter-label { font-size: 13px; font-weight: 600; color: var(--text-sub); margin-bottom: 8px; }
.filter-options { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chip {
  padding: 7px 14px; border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--bg); color: var(--text-sub);
  font-size: 13px; cursor: pointer;
}
.filter-chip.active {
  background: var(--primary); border-color: var(--primary);
  color: white; font-weight: 700;
}

/* Map Loading */
.map-loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #E8F4F0, #EEF2FF, #FEF3F2);
  z-index: 5;
}
.map-loading-inner { text-align: center; }

/* 매장 로고 배지 */
.store-logo-badge {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800;
  text-align: center; line-height: 1.3;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.store-logo-emoji { font-size: 32px; }

/* 매장 카드 내 로고 크기 조정 */
.store-card .store-logo-badge {
  width: 44px; height: 44px;
  border-radius: 10px;
  font-size: 9px;
  margin-bottom: 6px;
}

/* 매장 상세 내 로고 크기 조정 */
.store-detail-img .store-logo-badge {
  width: 56px; height: 56px;
  border-radius: 16px;
  font-size: 11px;
}

/* Store Detail content (injected) */
.store-detail-header { display: flex; gap: 14px; margin-bottom: 16px; }
.store-detail-img { font-size: 48px; }
.store-detail-info { flex: 1; }
.store-detail-name { font-size: 18px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.store-detail-addr { font-size: 12px; color: var(--text-sub); margin-bottom: 6px; }
.store-detail-chips { display: flex; gap: 6px; }
.kuji-board-list { display: flex; flex-direction: column; gap: 10px; }
.kuji-board-card {
  background: var(--bg); border-radius: 12px;
  padding: 12px; border: 1px solid var(--border);
}
.board-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.board-name { font-size: 13px; font-weight: 700; color: var(--text); }
.board-remaining { font-size: 12px; font-weight: 700; color: var(--primary); }
.board-prizes { display: flex; flex-wrap: wrap; gap: 4px; }
.prize-chip {
  font-size: 11px; padding: 3px 8px; border-radius: 6px;
  font-weight: 600;
}
.prize-chip.avail { background: #D1FAE5; color: #059669; }
.prize-chip.sold { background: #F3F4F6; color: #9CA3AF; text-decoration: line-through; }
.board-time { font-size: 10px; color: var(--text-sub); margin-top: 6px; }
.action-btns { display: flex; gap: 10px; margin-top: 16px; }
.action-btn {
  flex: 1; padding: 12px;
  border-radius: 12px; border: none; cursor: pointer;
  font-size: 14px; font-weight: 600;
}
.action-btn.primary { background: var(--primary); color: white; }
.action-btn.secondary { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); }

/* 영업 상태 뱃지 */
.open-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px;
  white-space: nowrap; flex-shrink: 0;
}
.open-badge.open  { background: #D1FAE5; color: #059669; }
.open-badge.closed{ background: #FEE2E2; color: #DC2626; }
.open-badge.soon  { background: #FEF3C7; color: #D97706; }

/* 매장 영업시간 행 */
.store-hours-row {
  display: flex; align-items: center; gap: 8px;
  margin: 10px 0 4px;
  font-size: 12px; color: var(--text-sub);
}

/* 오픈 알림 버튼 */
.open-alert-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 10px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 12px; font-size: 13px; font-weight: 600;
  color: var(--text-sub); cursor: pointer; transition: all 0.2s;
  margin-bottom: 14px;
}
.open-alert-btn.active {
  background: #FEF3C7; border-color: #D97706; color: #D97706;
}

/* ── 판매점 상세 페이지 ─────────────────────────────────────── */
.page-store {
  position: absolute; inset: 0;
  z-index: 500;   /* 네이버지도 attribution(~200) 위에 표시 */
  background: var(--bg);
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.32,0.72,0,1);
  display: flex !important; /* 항상 flex, 이동으로 숨김 */
  visibility: hidden;
  pointer-events: none;
}
.page-store.open {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}
.store-page-header {
  gap: 4px;
}
.back-btn {
  color: var(--text); display: flex; align-items: center; justify-content: center;
}
.store-page-body {
  flex: 1; overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 0 40px;
}

/* 판매점 히어로 영역 */
.store-hero {
  padding: 20px 20px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.store-hero-top {
  display: flex; gap: 16px; align-items: flex-start; margin-bottom: 12px;
}
.store-hero-emoji { font-size: 52px; line-height: 1; flex-shrink: 0; }
.store-hero-info { flex: 1; }
.store-hero-name { font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.store-hero-addr { font-size: 13px; color: var(--text-sub); margin-bottom: 8px; }
.store-hero-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.store-hero-actions {
  display: flex; gap: 8px; margin-top: 4px;
}
.store-action-btn {
  flex: 1; padding: 10px 0;
  border-radius: 12px; border: 1.5px solid var(--border);
  background: var(--bg); color: var(--text);
  font-size: 13px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all .15s;
}
.store-action-btn.primary {
  background: var(--primary); color: white; border-color: var(--primary);
}
.store-action-btn:hover { opacity: 0.85; }

/* 쿠지판 섹션 */
.store-kuji-section {
  padding: 20px 16px 0;
}
.store-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.store-section-title {
  font-size: 16px; font-weight: 800; color: var(--text);
}
.store-section-count {
  font-size: 13px; font-weight: 600; color: var(--text-sub);
  background: var(--border); padding: 3px 10px; border-radius: 20px;
}

/* 쿠지 카드 (풀페이지용 - 확장형) */
.kuji-full-card {
  background: var(--card); border-radius: 16px;
  border: 1px solid var(--border);
  margin-bottom: 12px; overflow: hidden;
  transition: box-shadow .15s;
}
.kuji-full-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
.kuji-full-header {
  padding: 14px 16px;
  display: flex; gap: 12px; align-items: flex-start;
  cursor: pointer; /* 탭해서 확장 */
}
.kuji-full-emoji { font-size: 32px; flex-shrink: 0; }
.kuji-full-meta { flex: 1; min-width: 0; }
.kuji-full-name {
  font-size: 14px; font-weight: 700; color: var(--text);
  margin-bottom: 4px; line-height: 1.4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kuji-full-sub {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
}
.kuji-remaining-badge {
  font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 6px;
  background: #EEF2FF; color: var(--primary);
}
.kuji-updated { font-size: 11px; color: var(--text-sub); }
.kuji-expand-icon {
  font-size: 18px; color: var(--text-sub); flex-shrink: 0;
  transition: transform .25s; align-self: center;
}
.kuji-full-card.expanded .kuji-expand-icon { transform: rotate(180deg); }

/* 확장 시 보이는 상세 */
.kuji-full-detail {
  display: none;
  padding: 0 16px 14px;
  border-top: 1px solid var(--border);
}
.kuji-full-card.expanded .kuji-full-detail { display: block; }
.kuji-prize-table {
  width: 100%; border-collapse: collapse; margin-top: 10px;
}
.kuji-prize-table th {
  font-size: 11px; font-weight: 600; color: var(--text-sub);
  padding: 6px 8px; text-align: left;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.kuji-prize-table td {
  padding: 8px 8px; font-size: 13px;
  border-bottom: 1px solid var(--border); vertical-align: middle;
}
.kuji-prize-table tr:last-child td { border-bottom: none; }
.kuji-prize-table tr.last-row { background: #FFFBEB; }
.prize-grade { font-weight: 700; font-size: 12px; }
.prize-avail { color: #059669; font-weight: 700; }
.prize-sold  { color: #9CA3AF; }
.prize-last  { color: #D97706; font-weight: 700; }
.kuji-detail-footer {
  display: flex; gap: 8px; margin-top: 12px;
}
.kuji-detail-btn {
  flex: 1; padding: 9px 0;
  border-radius: 10px; border: 1.5px solid var(--border);
  background: var(--bg); color: var(--text);
  font-size: 12px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.kuji-detail-btn.primary {
  background: var(--primary); color: white; border-color: var(--primary);
}

/* MY 페이지 */
.my-body {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
  overscroll-behavior: contain;
}
.my-profile-card {
  background: linear-gradient(135deg, var(--primary) 0%, #FF7A45 100%);
  border-radius: 20px; padding: 18px 20px;
  display: flex; align-items: center; gap: 14px; color: white;
}
.my-avatar {
  width: 54px; height: 54px; background: rgba(255,255,255,0.25);
  border-radius: 27px; display: flex; align-items: center;
  justify-content: center; font-size: 26px; flex-shrink: 0;
}
.my-profile-info { flex: 1; min-width: 0; }
.my-name { font-size: 17px; font-weight: 800; }
.my-level { font-size: 12px; opacity: 0.88; margin-top: 2px; }
.my-edit-btn {
  background: rgba(255,255,255,0.25); border: none;
  border-radius: 8px; padding: 6px 12px;
  color: white; font-size: 12px; font-weight: 700; cursor: pointer;
  flex-shrink: 0;
}

.my-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--card); border-radius: 16px;
  border: 1px solid var(--border); overflow: hidden;
}
.my-stat {
  padding: 13px 6px; text-align: center;
  border-right: 1px solid var(--border);
}
.my-stat:last-child { border-right: none; }
.my-stat-num { font-size: 19px; font-weight: 800; color: var(--primary); }
.my-stat-label { font-size: 10px; color: var(--text-sub); margin-top: 2px; }

.my-section { display: flex; flex-direction: column; gap: 8px; }
.my-section-header {
  display: flex; align-items: center; justify-content: space-between;
}
.my-section-title { font-size: 13px; font-weight: 700; color: var(--text-sub); text-transform: uppercase; letter-spacing: 0.4px; }

.my-fav-item {
  background: var(--card); border-radius: 14px;
  padding: 12px 14px; display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); cursor: pointer;
  transition: border-color 0.2s;
}
.my-fav-item:active { border-color: var(--primary); }
.my-fav-emoji { font-size: 24px; flex-shrink: 0; }
.my-fav-info { flex: 1; min-width: 0; }
.my-fav-name { font-size: 13px; font-weight: 700; color: var(--text); }
.my-fav-sub  { font-size: 11px; color: var(--text-sub); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.my-visit-item {
  background: var(--card); border-radius: 14px;
  padding: 12px 14px; display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border);
}
.my-visit-date {
  font-size: 10px; color: var(--text-sub); flex-shrink: 0;
  text-align: center; line-height: 1.5; min-width: 32px;
}

.my-menu-list {
  background: var(--card); border-radius: 14px;
  border: 1px solid var(--border); overflow: hidden;
  display: flex; flex-direction: column;
}
.my-menu-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border: none; background: none; cursor: pointer;
  font-size: 14px; color: var(--text); text-align: left;
  border-bottom: 1px solid var(--border);
}
.my-menu-item:last-child { border-bottom: none; }
.my-menu-arrow { font-size: 18px; color: var(--text-sub); }

/* Toast */
.toast {
  position: absolute;
  bottom: 90px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1A1A2E; color: white;
  padding: 12px 20px; border-radius: 12px;
  font-size: 13px; font-weight: 600;
  opacity: 0; transition: all 0.3s;
  pointer-events: none;
  white-space: nowrap;
  z-index: 200;
}
.toast.show {
  opacity: 1; transform: translateX(-50%) translateY(0);
}

/* ══════════════════════════════════════════
   반응형 — 태블릿 (768px+)
══════════════════════════════════════════ */
@media (min-width: 768px) {
  .page-header { padding: 16px 28px; }
  .page-header h2 { font-size: 20px; }

  /* 지도 외 페이지 콘텐츠 중앙 정렬 */
  .search-page-body,
  .register-body,
  .alert-scroll,
  .my-body {
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
  }

  .alert-tabs { max-width: 640px; margin: 0 auto; width: 100%; }

  .store-card { min-width: 130px; }
  .bottom-preview.expanded { max-height: 240px; }

  /* 바텀 프리뷰 중앙 정렬 */
  .preview-header,
  .store-list-horizontal { max-width: 900px; margin-left: auto; margin-right: auto; }

  /* PC: 좌우 화살표 표시 */
  .preview-arrows { display: flex; }
}

/* ══════════════════════════════════════════
   반응형 — 데스크톱 (1024px+): 좌측 사이드바
══════════════════════════════════════════ */
@media (min-width: 1024px) {
  #app { flex-direction: row; }

  /* 좌측 사이드바 네비 */
  .bottom-nav {
    width: 220px;
    min-width: 220px;
    flex-direction: column;
    border-top: none;
    border-right: 1px solid var(--border);
    padding: 24px 12px 24px;
    justify-content: flex-start;
    gap: 4px;
    order: -1;
    height: 100%;
    overflow-y: auto;
  }
  .nav-btn {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    padding: 12px 16px;
    border-radius: 12px;
    gap: 12px;
    width: 100%;
    transition: background 0.15s;
  }
  .nav-btn:hover { background: var(--bg); }
  .nav-btn.active { background: #FFF5F7; }
  .nav-icon { font-size: 20px; }
  .nav-label {
    font-size: 14px; color: var(--text); font-weight: 500;
  }
  .nav-btn.active .nav-label { color: var(--primary); font-weight: 700; }

  /* 등록 버튼 사이드바 스타일 */
  .register-nav .register-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    font-size: 20px;
    margin-top: 0;
  }

  /* 사이드바 로고 영역 */
  .bottom-nav::before {
    content: '쿠지맵';
    display: block;
    font-size: 18px; font-weight: 900;
    color: var(--primary);
    padding: 8px 16px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
    letter-spacing: -0.5px;
  }

  /* 페이지 영역이 사이드바 제외 나머지 차지 */
  .page { flex: 1; min-width: 0; }

  /* 모달 위치 — 사이드바 제외 영역 기준 */
  .modal-overlay { left: 220px; }
  .modal { left: 220px; }
  .page-store { left: 220px; } /* 사이드바 오른쪽 영역에만 표시 */

  /* 콘텐츠 최대 너비 */
  .search-page-body,
  .register-body,
  .alert-scroll,
  .my-body { max-width: 720px; }

  .map-legend { bottom: 16px; }
}
