/* =============================================================
   핫딜러 스타일
   - 모바일 우선(Mobile First), 터치 타깃 44px+ 보장
   - 따뜻한 웜뉴트럴 + 코랄 포인트 테마 + 야간(다크) 모드
   - 색상은 CSS 변수로 관리: [data-theme="dark"] 에서 재정의
   - 본문 폰트: Pretendard (한글 가독성·트렌디한 인상의 핵심)
   ============================================================= */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.css');

:root {
  /* 따뜻하고 자연스러운 톤 — 크림 배경 + 코랄/테라코타 포인트 */
  --bg: #faf6f0;
  --bg-grad: radial-gradient(1200px 640px at 50% -12%, #fdecdf 0%, #faf6f0 46%, #f7f2ea 100%);
  --surface: #fffdf9;
  --surface-2: #f5efe6;
  --text: #3a342d;
  --text-muted: #9a8f81;
  --primary: #ee7d5a;
  --primary-strong: #db6440;
  --primary-ink: #ffffff;
  --primary-soft: #fbe7db;
  --accent: #d8634a;        /* 할인율(%) 등 포인트 (따뜻한 테라코타) */
  --accent-soft: #f8e1d8;
  --price: #ed1b2f;         /* 가격 — 쨍한 순수 빨강 */
  --border: #ece2d5;
  --shadow: 0 10px 28px rgba(180, 120, 80, 0.12);
  --shadow-sm: 0 3px 12px rgba(180, 120, 80, 0.08);
  --radius: 20px;
  --radius-sm: 14px;
  --header-h: 60px;
  --maxw: 760px;
}

[data-theme="dark"] {
  /* 포근한 밤 — 웜 다크 */
  --bg: #1b1613;
  --bg-grad: radial-gradient(1200px 640px at 50% -12%, #2b211a 0%, #1b1613 56%);
  --surface: #2a221b;      /* 배경과 확실히 구분되게 한 단계 밝게 */
  --surface-2: #362c24;
  --text: #f1e9df;
  --text-muted: #b3a797;
  --primary: #f0875f;
  --primary-strong: #f6a282;
  --primary-ink: #2a160d;
  --primary-soft: #3a2a21;
  --accent: #ef7d5d;
  --accent-soft: #3a261f;
  --price: #ff4d57;         /* 가격 — 다크모드용 밝은 빨강 */
  --border: #4d3f35;
  /* 야간엔 그림자가 안 보여 경계가 사라짐 → 그림자에 1px 링을 얹어 모든 카드/표면에 윤곽선 부여 */
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.13);
  --shadow-sm: 0 3px 12px rgba(0, 0, 0, 0.38), 0 0 0 1px rgba(255, 255, 255, 0.11);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", "Segoe UI", Roboto, "Malgun Gothic", sans-serif;
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  line-height: 1.55;
  letter-spacing: -0.01em;            /* Pretendard 는 살짝 좁혀야 더 단정함 */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

body.no-scroll { overflow: hidden; }

a { color: inherit; text-decoration: none; }

/* 키보드 탐색 시 포커스 링 (마우스 클릭에는 안 뜸) */
:is(a, button, input, select, [tabindex]):focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* 인라인 SVG 아이콘 (텍스트 색 상속, 글자 높이에 맞춤) */
.ic { width: 1em; height: 1em; vertical-align: -0.125em; display: inline-block; flex-shrink: 0; }

/* ---------- 헤더 ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--surface);   /* color-mix 미지원(구형 웹뷰) 폴백 */
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}
.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
}
.brand {
  display: flex;
  align-items: center;
  font-family: Georgia, 'Times New Roman', 'Nanum Myeongjo', serif;
  font-weight: 400;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  white-space: nowrap;
  color: var(--text);
}
.brand-icon { width: 40px; height: 40px; margin-right: 10px; flex: none; }

.search {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 6px 0 14px;
  min-width: 0;
  position: relative;   /* 최근 검색어 드롭다운 기준점 */
}

/* ---------- 최근 검색어 드롭다운 ---------- */
.search-history {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 10px;
  z-index: 45;
  animation: menu-pop .14s ease;
}
.search-history[hidden] { display: none; }
.sh-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 132px;      /* 10개 다 저장하되 패널이 길어지지 않게: 넘치면 스크롤 (모바일 포함) */
  overflow-y: auto;
}
.sh-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.sh-go {
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  padding: 6px 4px 6px 12px;
  cursor: pointer;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sh-del {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  padding: 6px 10px 6px 4px;
  cursor: pointer;
}
.sh-del:active { color: var(--price); }
.sh-empty {
  margin: 4px 6px 6px;
  color: var(--text-muted);
  font-size: 13px;
}
.sh-foot {
  display: flex;
  justify-content: flex-end;        /* 우측 하단 */
  border-top: 1px solid var(--border);  /* 줄 하나 */
  margin-top: 8px;
  padding-top: 8px;
}
.sh-toggle {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
}
.sh-toggle:active { color: var(--text); }
@media (hover: hover) {
  .sh-chip:hover { border-color: var(--primary); }
  .sh-del:hover { color: var(--price); }
  .sh-toggle:hover { color: var(--text); text-decoration: underline; }
}
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  padding: 10px 4px;
  outline: none;
}
.search input::placeholder { color: var(--text-muted); }
.search-btn {
  border: 0;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.header-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border: 0;
  background: transparent;
  border-radius: 12px;
  font-size: 19px;
  cursor: pointer;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:active { background: var(--primary-soft); }

/* 테마 토글(달/해) — 노란색으로 눈에 띄게 */
[data-theme-toggle] { color: #e6a417; }
[data-theme="dark"] [data-theme-toggle] { color: #ffd24a; }
/* 달은 속을 채워 더 또렷하게 (crescent 패스가 닫혀 있어 채우면 초승달 실루엣) */
[data-theme-toggle] .ic-line path { fill: currentColor; }

/* ---------- 드롭다운 메뉴 ---------- */
.menu-dropdown { position: relative; }
.menu-content {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 184px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 50;
}
.menu-content.show { display: flex; animation: menu-pop .14s ease; }
@keyframes menu-pop {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
}
.menu-item:active { background: var(--primary-soft); }
@media (hover: hover) { .menu-item:hover { background: var(--primary-soft); } }
.menu-item-icon {                 /* 이모지·SVG 혼용 — 고정폭 박스로 세로/가로 정렬 통일 */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 20px;
  font-size: 17px;
  line-height: 1;
}
.menu-item-icon .ic { width: 18px; height: 18px; }
.menu-item-icon .ic-heart { width: 18px; height: 18px; color: #ff5160; }   /* 찜 하트는 시그니처 색 */

/* 카테고리 서브메뉴: 메뉴 왼쪽으로 플라이아웃 (데스크탑 호버 / 모바일 탭) */
.menu-cats { position: relative; }
.menu-cats-list {
  display: none;
  position: absolute;
  top: -7px;                      /* 메뉴 박스 상단(패딩 6px+테두리)과 나란히 */
  right: calc(100% + 14px);
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  min-width: 210px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 6px;
}
.menu-cats-list::after {          /* 버튼↔서브메뉴 사이 간격에서 호버가 끊기지 않게 투명 다리 */
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: 100%;
  width: 16px;
}
.menu-cats-list .menu-item { padding: 9px 12px; font-size: 14px; font-weight: 500; }
.menu-cats-list.show { display: grid; animation: menu-pop .14s ease; }
.menu-cats-hint { display: none; }   /* 스크롤 힌트는 모바일(max-height 있는 화면)에서만 */
@media (hover: hover) and (pointer: fine) {
  .menu-cats:hover .menu-cats-list { display: grid; }
}
@media (max-width: 480px) {       /* 좁은 화면: 1열 + 세로 스크롤만 (좌우 잠금) */
  .menu-cats-list {
    grid-template-columns: 1fr;
    min-width: 158px;              /* 가장 긴 이름(헬스/건강식품)도 한 줄에 들어가게 */
    max-height: 62vh;
    overflow-y: auto;
    overflow-x: hidden;
    touch-action: pan-y;           /* 터치 스와이프를 세로로만 허용 */
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--surface-2);
  }
  .menu-cats-list::after { display: none; }   /* 데스크탑 호버용 투명 다리 — 모바일에선 가로 넘침 원인 */
  .menu-cats-list::-webkit-scrollbar { width: 5px; }
  .menu-cats-list::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 999px; }
  .menu-cats-list::-webkit-scrollbar-track { background: var(--surface-2); border-radius: 999px; }
  /* '아래 더 있음' 상시 힌트 — 하단 그라데이션 + 화살표, 끝까지 내리면 사라짐 */
  .menu-cats-hint {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    position: sticky;
    bottom: -6px;                 /* 목록 패딩(6px)까지 덮어 바닥에 밀착 */
    grid-column: 1 / -1;
    height: 34px;
    margin: -34px -6px -6px;      /* 마지막 항목 위에 겹쳐 표시 */
    background: linear-gradient(to bottom, transparent, var(--surface) 72%);
    color: var(--primary);
    pointer-events: none;
    opacity: 1;
    transition: opacity .15s ease;
  }
  .menu-cats-hint svg { width: 16px; height: 16px; margin-bottom: 4px; animation: cats-nudge 1.3s ease-in-out infinite; }
  .menu-cats-list.at-end .menu-cats-hint { opacity: 0; }
}
@keyframes cats-nudge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(3px); }
}

/* 데스크탑(마우스): 호버 시 자동으로 펼침. 모바일(터치)은 탭으로 동작 */
@media (hover: hover) and (pointer: fine) {
  .menu-dropdown:hover .menu-content,
  .menu-dropdown:focus-within .menu-content { display: flex; }
  /* 버튼↔메뉴 사이 8px 간격에서 호버가 끊기지 않게 투명 다리 */
  .menu-content::before {
    content: '';
    position: absolute;
    left: 0; right: 0;
    top: -10px;
    height: 10px;
  }
}

/* 모바일: 헤더 요소를 조여 검색창 폭 확보 (로고·아이콘·간격·패딩 축소) */
@media (max-width: 480px) {
  .header-inner { gap: 6px; padding: 0 10px; }
  .brand { font-size: 13px; letter-spacing: 0.05em; }
  .brand-icon { width: 34px; height: 34px; margin-right: 7px; }
  .icon-btn { width: 36px; min-width: 36px; height: 36px; font-size: 18px; }
  .search { padding: 0 4px 0 12px; }
  .search input { font-size: 14px; padding: 9px 2px; }
  .search-btn { width: 32px; height: 32px; }
}
@media (max-width: 360px) {
  .brand { font-size: 11px; letter-spacing: 0.01em; }
  .brand-icon { width: 30px; height: 30px; margin-right: 6px; }
  .icon-btn { width: 34px; min-width: 34px; }
}

/* ---------- 컨테이너 ---------- */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px 14px 40px;
}

.page-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.035em;
  margin: 12px 2px 16px;
}
.heading-icon {
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.2em;
  margin-right: 3px;
}
.live-dot {
  width: 9px;
  height: 9px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent);
  animation: live-pulse 1.9s ease-out infinite;
}
@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  70%  { box-shadow: 0 0 0 10px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
/* '핫딜'만 살짝 포인트 컬러로 강조 */
.heading-accent { color: var(--accent); }

/* 사이트명 박스 — 검색창처럼 생긴 브랜드 각인 (메인 제목·상세 상단 우측) */
.brand-box {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 3px solid #03c75a;   /* 네이버 그린, 두껍게 */
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #03c75a;
  white-space: nowrap;
  flex-shrink: 0;
}
.brand-box .bb-ic { width: 15px; height: 15px; }

/* 메뉴 안의 '홈 바로가기 추가' 버튼 — 링크형 메뉴와 같은 생김새 */
button.menu-item {
  background: none;
  border: 0;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.menu-item[hidden] { display: none; }

/* 홈 화면 바로가기 버튼 (푸터) + iOS 안내 오버레이 */
.pwa-install {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 auto 16px;
  padding: 11px 20px;
  border: 1.5px solid var(--primary);
  border-radius: 999px;
  background: transparent;
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
@media (hover: hover) { .pwa-install:hover { background: var(--primary-soft); } }
.pwa-install[hidden] { display: none; }
.pwa-install svg { width: 17px; height: 17px; }
.ios-guide {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.ios-guide-box {
  background: var(--surface); color: var(--text);
  border-radius: 16px; padding: 24px 22px; max-width: 320px; text-align: center;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
}
.ios-guide-box strong { font-size: 16px; }
.ios-guide-box p { margin: 12px 0 18px; line-height: 1.65; font-size: 14px; color: var(--text-muted); }
.ios-guide-box b { color: var(--text); }
.ios-guide-box button {
  padding: 11px 30px; border: 0; border-radius: 10px;
  background: var(--primary); color: var(--primary-ink); font-weight: 700; cursor: pointer;
}
/* 사파리 하단 툴바의 공유 버튼 위치를 가리키는 화살표 */
.ios-arrow {
  position: fixed; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); left: 50%;
  transform: translateX(-50%);
  font-size: 34px; color: #fff; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  animation: iosbounce 1s ease-in-out infinite;
  pointer-events: none;
}
@keyframes iosbounce {
  0%, 100% { transform: translate(-50%, 0); }
  50%      { transform: translate(-50%, 10px); }
}

/* 상세 상단: 뒤로가기 + 브랜드 박스 한 줄 */
.page-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.page-topbar .back-link { margin-bottom: 0; }

/* 정렬 셀렉트 — 카테고리 필터 아래·상품 리스트 위, 우측 정렬 */
.sort-row { display: flex; justify-content: flex-end; }
.sort-row .sort-select { margin: 0 0 10px; }  /* 셀렉트 숨김 시 여백도 없음 */
.sort-select {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  padding: 7px 10px;
  cursor: pointer;
}
.sort-select[hidden] { display: none; }

/* 위로가기 플로팅 버튼 */
.to-top {
  position: fixed;
  right: 16px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
  z-index: 20;
}
.to-top[hidden] { display: none; }
@media (hover: hover) { .to-top:hover { color: var(--primary-strong); border-color: var(--primary); } }

/* ---------- 상품 발굴 (오로라 버튼 + /discover 페이지) ---------- */
.aurora-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 18px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(120deg, #8b5cf6, #3b82f6, #06b6d4, #a855f7, #8b5cf6);
  background-size: 320% 320%;
  animation: aurora-shift 7s ease infinite;
  box-shadow: 0 6px 20px rgba(110, 90, 250, .32);
}
.aurora-btn b { font-weight: 800; }
.aurora-btn:active { filter: brightness(.94); }
@media (hover: hover) { .aurora-btn:hover { filter: brightness(1.06); } }
@keyframes aurora-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@media (prefers-reduced-motion: reduce) { .aurora-btn { animation: none; } }
.discover-banner { display: flex; width: 100%; margin: 0 0 14px; }

.discover-hero { text-align: center; padding: 18px 0 8px; }
.discover-title { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; margin: 0 0 8px; }
.discover-desc { color: var(--text-muted); font-size: 14px; margin: 0 0 18px; }
.discover-form { display: flex; gap: 8px; max-width: 480px; margin: 0 auto; }
.discover-form input {
  flex: 1;
  min-width: 0;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  padding: 12px 16px;
  outline: none;
}
.discover-form input:focus { border-color: var(--primary); }
.discover-submit { flex: 0 0 auto; }
.discover-note { color: var(--text-muted); font-size: 12px; margin: 12px 0 4px; }

/* 후보 카드: 링크가 아니라 버튼 (누르면 등록) */
.cand-card { text-align: left; border: 0; padding: 0; font: inherit; cursor: pointer; }
.cand-card.collecting { opacity: .55; pointer-events: none; }
.cand-cta { color: var(--primary); font-weight: 700; }
.cand-card.collected { outline: 2px solid var(--primary); }
.cand-card.collected .cand-cta { color: var(--accent); }

/* 검색결과 하단 자동 발굴 섹션 */
#auto-discover { margin-top: 28px; }
#auto-discover .state-msg { margin-bottom: 12px; }

/* 상세 하단 관련 핫딜 */
.related-section { margin-top: 28px; }
.related-more { height: 1px; }   /* 무한 스크롤 표지 — 보이면 30개 더 받는다 */
.related-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 14px 2px;
}

/* 데모/안내 배너 */
.banner {
  background: var(--primary-soft);
  border: 1px solid var(--border);
  color: var(--primary-strong);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}

/* ---------- 핫딜 카드 (이미지 중심 그리드) ---------- */
.deal-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 12px;
}

/* 광고 슬롯: 비어있으면(광고 미설정) 완전히 숨겨 레이아웃에 영향 0, 채워지면 여백 부여 */
.ad-slot:empty { display: none; }
.ad-slot { margin: 24px 0; text-align: center; }
.ad-slot--infeed { grid-column: 1 / -1; margin: 4px 0; }  /* 리스트 그리드 안에서 전체폭 */
.ad-slot .adsbygoogle { display: block; }

.deal-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;                  /* 이미지 모서리 클립 */
  box-shadow: var(--shadow-sm);
  transition: transform .16s ease, box-shadow .22s ease;
  min-width: 0;
}
.deal-card:active { transform: scale(.985); }
@media (hover: hover) {
  .deal-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); }
}

/* 썸네일: 카드 폭을 꽉 채운 정사각 이미지 (커머스 느낌의 핵심) */
.thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.thumb-img { width: 100%; height: 100%; object-fit: cover; }
.thumb-fallback { font-size: 40px; color: var(--text-muted); opacity: .5; }

/* 이미지 위 오버레이 뱃지 (몰 이름 / 종료) */
.thumb-badge {
  position: absolute;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  white-space: nowrap;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.thumb-badge.mall {
  left: 8px; bottom: 8px;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  color: var(--text);
  box-shadow: 0 1px 5px rgba(0, 0, 0, .12);
}
.thumb-badge.ended {
  right: 8px; top: 8px;
  background: rgba(38, 38, 42, .72);
  color: #fff;
}

.deal-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 11px 13px 13px;
}

.deal-title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.42;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.84em;                /* 항상 2줄 확보 → 카드 높이 균일 */
}

/* 가격 — 카드의 주인공: 크고 굵게. 할인율만 포인트 컬러 */
.price-group { display: flex; align-items: baseline; justify-content: flex-end; gap: 6px; flex-wrap: wrap; min-width: 0; }
.price { font-size: 19px; font-weight: 800; color: var(--price); letter-spacing: -0.02em; }
.discount-rate { color: var(--accent); font-weight: 800; font-size: 17px; letter-spacing: -0.02em; }
.price-original { color: var(--text-muted); text-decoration: line-through; font-weight: 500; font-size: 12px; }

/* 메타: 조회수(좌) · 시간(우) — 작고 흐리게 */
.deal-meta {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.views { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.views .ic { width: 14px; height: 14px; }
.time { white-space: nowrap; }

/* 뱃지(상세 페이지에서 계속 사용) */
.badges { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-mall { background: var(--surface-2); color: var(--text-muted); }
.badge-ended { background: #6b7785; color: #fff; }

/* 종료된 딜은 흐리게 */
.deal-card.is-ended { opacity: .62; }
.deal-card.is-ended .price { color: var(--text-muted); text-decoration: line-through; }
.view-card.is-ended .price-big { color: var(--text-muted); text-decoration: line-through; }

/* 쇼핑몰별 필터 칩 (가로 스크롤) */
.mall-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px 0 14px;
}
.mall-filter[hidden], .cat-filter[hidden] { display: none; } /* display:flex 가 hidden 속성을 이기는 것 방지 */
.mall-chip {
  flex: 0 0 auto;
  padding: 8px 15px;
  border-radius: 999px;
  border: 0;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
@media (hover: hover) { .mall-chip:hover { color: var(--text); } }   /* 터치 기기 스티키 호버 방지 */
.mall-chip.active {
  background: var(--primary);
  color: var(--primary-ink);
}
/* 카테고리 필터 — 몰 칩(둥근 pill·채움)과 형태부터 다르게: 라벨 + 사각라운드 아웃라인 + 다중선택 */
.cat-filter {
  display: flex;
  align-items: flex-start;   /* 펼쳐져도 ▾ 버튼은 첫 줄 우측에 고정 */
  gap: 8px;
  padding: 2px 0 12px;
}
.cat-chips {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.cat-filter.collapsed .cat-chips { overflow: hidden; } /* 높이는 JS가 칩 실측값으로 지정 → 둘째 줄 안 비침 */
.cat-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 9px;          /* cat-chip 과 같은 높이감 */
  border-radius: 10px;
  border: 1.5px solid var(--primary);
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.cat-toggle:active { background: var(--primary); color: var(--primary-ink); }
.cat-toggle svg { transition: transform .18s ease; }
.cat-toggle.open svg { transform: rotate(180deg); }
.cat-toggle[hidden] { display: none; }
@media (hover: hover) { .cat-toggle:hover { background: var(--primary); color: var(--primary-ink); } }
.cat-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .01em;
  color: var(--primary);
  padding-right: 2px;
}
.cat-chip {
  flex: 0 0 auto;
  padding: 7px 13px;
  border-radius: 10px;                 /* 몰 칩은 999px pill → 카테고리는 사각라운드로 구분 */
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
@media (hover: hover) { .cat-chip:hover { color: var(--text); border-color: var(--primary); } }   /* 터치 기기 스티키 호버 방지 */
.cat-chip.active {                      /* 다중선택된 칩 */
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
}

/* 할인중만 토글 — 빨강(accent) */
.discount-chip { border-color: var(--accent); color: var(--accent); }
@media (hover: hover) { .discount-chip:hover { border-color: var(--accent); } }
.discount-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* 카테고리 페이지 칩 내비 — 메인 필터 칩보다 큼직·도톰한 pill (서버 렌더 페이지용) */
.catnav {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 16px 0 24px;
}
.catnav-chip {
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background .15s, color .15s, border-color .15s, transform .12s;
}
.catnav-chip:active { transform: scale(.96); }
@media (hover: hover) {
  .catnav-chip:hover { border-color: var(--primary); color: var(--primary-strong); background: var(--primary-soft); }
}
.catnav-chip.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  border-color: transparent;
  color: var(--primary-ink);
  font-weight: 700;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 38%, transparent);
}
@media (max-width: 480px) {  /* 모바일: 칩을 한 단계 작게 */
  .catnav { gap: 7px; margin: 12px 0 18px; }
  .catnav-chip { padding: 7px 13px; font-size: 13px; }
}

/* 카테고리 페이지네이션 (서버 렌더 페이지용) */
.pagenav { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 22px 0 8px; }
.pagenav-btn {
  min-width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 10px; border-radius: 10px;
  border: 1.5px solid var(--border); background: var(--surface);
  font-size: 14px; font-weight: 600; color: var(--text-muted);
}
@media (hover: hover) { a.pagenav-btn:hover { border-color: var(--primary); color: var(--primary-strong); } }
.pagenav-btn.active { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }

/* 404·503 공식 안내 페이지 */
.notfound { text-align: center; padding: 44px 16px 20px; }
.notfound .nf-code { margin: 0; font-size: 56px; font-weight: 800; line-height: 1; color: var(--primary); }
.notfound .nf-title { margin: 14px 0 8px; font-size: 22px; }
.notfound .nf-desc { margin: 0 0 6px; color: var(--text-muted); font-size: 14px; line-height: 1.7; }
.notfound .nf-desc a { color: var(--primary); font-weight: 600; }
.notfound .nf-deal { font-weight: 700; color: var(--text); }
.notfound .nf-btn { display: inline-flex; margin: 18px auto 24px; }
.notfound .catnav { justify-content: center; }

/* 딜 상세: 카테고리 라인 (클라 렌더 — SSR 내부링크 유지용. 기존 .view-sub 와 이름 충돌 금지) */
.view-catline { margin: -4px 0 10px; font-size: 13px; color: var(--text-muted); }
.view-catline a { color: var(--primary); font-weight: 600; }

/* 무한스크롤 보조 */
.end-note, .state-msg {
  grid-column: 1 / -1;      /* 그리드(deal-list) 안에서 전체 폭 차지 → 중앙 정렬 */
  text-align: center;
  color: var(--text-muted);
  padding: 26px 10px;
  font-size: 14px;
}
.state-msg.small { padding: 14px; }
#scroll-sentinel { height: 1px; }

/* 스켈레톤 */
.skeleton { pointer-events: none; }
.sk {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: 8px;
}
.sk::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--primary-soft) 70%, transparent), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.2s infinite;
}
.thumb.sk { border-radius: 0; }
.sk-line { height: 13px; margin: 4px 0; }
.sk-line.short { width: 40%; }
.sk-line.med { width: 65%; }
.sk-title { height: 22px; width: 65%; margin: 8px 0 4px; }
.sk-price { height: 26px; width: 42%; margin: 20px 0 0 auto; }
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* 다음 목록 로딩 스피너 (반투명 원형 + 회전) */
.list-loader { display: flex; justify-content: center; padding: 18px 0 6px; }
.list-loader[hidden] { display: none; }
.list-loader .spinner {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow-sm);
}
.list-loader .spinner::before {
  content: "";
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2.5px solid color-mix(in srgb, var(--text-muted) 30%, transparent);
  border-top-color: var(--primary);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 상세 페이지 ---------- */
.back-link {
  display: inline-block;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 12px;
  font-size: 14px;
}
.view-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.view-title { font-size: 20px; font-weight: 800; line-height: 1.4; margin: 12px 0; }
.view-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.view-actions-inline { display: flex; gap: 14px; align-items: center; }
.link-muted {
  color: var(--primary-strong);
  font-weight: 600;
  background: none;
  border: 0;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
}
.link-muted.danger { color: var(--text-muted); display: inline-flex; align-items: center; }
.link-muted.danger:hover { color: var(--accent); }
.link-muted .ic { width: 17px; height: 17px; }
.meta-ico { display: inline-flex; align-items: center; gap: 4px; }
.meta-ico .ic { width: 14px; height: 14px; }
.meta-sep { margin: 0 2px; opacity: .6; }

/* 상세 상단: 뱃지(좌) + 아이콘 액션(우) */
.view-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.view-top .badges { flex: 1; }
.view-icon-actions { display: flex; gap: 8px; flex-shrink: 0; }
.act-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
}
.act-btn:active { background: var(--primary-soft); }
@media (hover: hover) { .act-btn:hover { color: var(--primary-strong); border-color: var(--primary); } }
.act-btn[aria-pressed="true"] { color: var(--primary-strong); border-color: var(--primary); background: var(--primary-soft); }

.price-box {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 10px;
  margin: 18px 0;
}
.price-mall { font-size: 14px; font-weight: 700; color: var(--text-muted); }
.price-big { font-size: 30px; font-weight: 800; color: var(--price); letter-spacing: -0.02em; }
.price-big-wrap { display: inline-flex; align-items: baseline; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.price-big-wrap .discount-rate { font-size: 20px; }
.price-big-wrap .price-original { font-size: 15px; }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  border: 0;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
}
.btn-buy {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: var(--primary-ink);
  box-shadow: var(--shadow);
}
.btn-buy:active { filter: brightness(.96); }
.buy-note {
  margin: 6px 2px 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-muted);
  text-align: right;
}
/* 쿠팡 파트너스 필수 고지 — 문구·위치는 유지(정책 요건), 존재감만 최소화(작고 연한 회색) */
.buy-note.coupang-notice {
  margin: 0 0 14px;
  padding: 0 2px;
  font-size: 11px;
  line-height: 1.45;
  text-align: left;
  color: var(--text-muted);
  background: none;
  border-radius: 0;
}

/* 구매 바: view-card 안 하단에 종속. 스크롤 중엔 화면 하단에 떠다니다(sticky) 카드 끝에 닿으면 정착 */
.buy-bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin: 16px -18px -18px;                          /* 카드 좌우·하단 패딩(18px) 상쇄 → 카드에 밀착 */
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);    /* 카드 하단 라운드와 일치 */
}
.buy-bar .btn-buy { min-height: 52px; }
/* 제휴 안내: 작은 'ⓘ 링크' + 호버(데스크탑)/탭(모바일) 툴팁 */
.aff-note {
  margin-top: 20px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 12px;
}
.aff-note-label { line-height: 1; }
.report-label { margin-left: auto; }               /* 신고를 맨 우측으로 */
.report-ico { border: 0; background: none; padding: 0; font: inherit; }
.report-ico:hover { color: var(--accent); }
.aff-note-tip.report-tip { left: auto; right: -12px; text-align: right; }
/* 호버 트리거는 이 아이콘에만 한정 */
.aff-note-ico {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  color: var(--text-muted);
}
.aff-note-tip {
  text-align: left;
  position: absolute;
  top: calc(100% + 10px);
  left: -12px;
  background-color: #f5f5f5;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  color: #555;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s ease, visibility .15s ease;
  z-index: 1000;
  min-width: 250px;
  white-space: normal;
  line-height: 1.4;
  user-select: text;
  -webkit-user-select: text;
}
.aff-note-tip.show { opacity: 1; visibility: visible; }
@media (hover: hover) {
  .aff-note-ico:hover + .aff-note-tip,
  .aff-note-ico:focus-visible + .aff-note-tip { opacity: 1; visibility: visible; }
}
[data-theme="dark"] .aff-note-tip {
  background-color: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

.btn-row { display: flex; gap: 10px; margin-top: 14px; }
.btn-soft {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-soft:active { background: var(--primary-soft); }

.info-section { margin-top: 22px; }
.info-title {
  font-size: 16px;
  font-weight: 800;
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-soft);
}
.info-body { font-size: 15px; color: var(--text); word-break: break-word; }
.info-media {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  aspect-ratio: 1 / 1;               /* 정사각 고정 → 스켈레톤·이미지 크기 동일 → 튕김 없음 */
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
}
.info-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;               /* 전체 이미지 보이게(크롭 X), 정사각 안에 맞춤 */
  opacity: 0;
  transition: opacity .35s ease;
}
.info-img.loaded { opacity: 1; }
.info-text { margin: 14px 0 0; }

/* 찜 페이지: 제목·빈 상태의 하트는 시그니처 색으로 고정 */
.page-heading .ic-heart, .state-msg .ic-heart { color: #ff5160; }
.deal-card-link { display: flex; flex-direction: column; width: 100%; min-width: 0; color: inherit; }
/* ---------- 정적 문서 페이지(약관 등) ---------- */
.doc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.doc h1 { font-size: 22px; margin-top: 0; }
.doc h2 { font-size: 17px; margin-top: 26px; }
.doc p, .doc li { color: var(--text); font-size: 15px; }
.doc .muted { color: var(--text-muted); font-size: 13px; }
/* 문서 장(소개·약관·가이드·문의…) 상단 — 제목 오른쪽에 핫딜 목록 복귀 알약 단추. 글 아래에는 .home-return (2026-10-13 전 장 적용) */
.doc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.doc-head h1 { margin-bottom: 0; }
.doc-top-link {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 4px;
  margin-top: 2px; padding: 7px 12px;
  border: 1px solid var(--primary-soft); border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-strong);
  font-size: 13px; font-weight: 700; text-decoration: none; white-space: nowrap;
}
.doc-top-link:active { filter: brightness(.96); }
@media (hover: hover) { .doc-top-link:hover { background: var(--accent-soft); } }
/* 찜 장 — 큰 제목(page-heading) 줄에도 같은 알약 단추 */
.doc-head.page-head { align-items: center; margin: 12px 2px 16px; }
.doc-head.page-head .page-heading { margin: 0; }
.doc-head.page-head .doc-top-link { margin-top: 0; }

/* ---------- 푸터 ---------- */
.app-footer {
  max-width: var(--maxw);
  margin: 30px auto 0;
  padding: 20px 16px calc(28px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}
.affiliate-notice {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: 0 0 14px;
  line-height: 1.6;
}
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-bottom: 10px; }
.footer-links a { color: var(--text); font-weight: 600; }
.footer-links .dot { color: var(--border); }
.copyright { margin: 0; }

/* ---------- 토스트 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--surface);
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;   /* 문구+보러가기가 두 줄로 꺾이지 않게 항상 한 줄 */
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 60;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* PC(넓은 화면): 토스트를 화면 정중앙에 표시 */
@media (min-width: 768px) {
  .toast {
    bottom: auto;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.95);
  }
  .toast.show { transform: translate(-50%, -50%) scale(1); }
}

/* ---------- 넓은 화면: 3열 그리드 ---------- */
@media (min-width: 560px) {
  .deal-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ── 실시간 조회 TOP10 위젯 ── */
.pop-rank {                          /* PC: 본문(760px) 우측 여백에 고정 패널 */
  display: none;
  position: fixed;
  top: 92px;
  left: calc(50% + 396px);
  width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  padding: 12px 10px 6px;
  z-index: 20;
}
@media (min-width: 1320px) { .pop-rank { display: block; } }

.pop-head { position: relative; display: flex; align-items: center; gap: 5px; margin: 0 4px 8px; }
.pop-head-tit { font-size: 14px; font-weight: 800; }
.pop-info { display: inline-flex; align-items: center; padding: 0; border: 0; background: none; font-size: 13px; color: var(--text-muted); cursor: pointer; }
.pop-sub { margin-left: auto; font-size: 11px; color: var(--text-muted); }
.pop-tip {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 50;
  margin: 0; padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  font-size: 12px; font-weight: 400; line-height: 1.55; color: var(--text-muted);
  word-break: keep-all; overflow-wrap: break-word;   /* 어절 단위 줄바꿈 — 단어 중간에서 안 꺾임 */
}

@keyframes pop-flip-in { from { opacity: 0; transform: rotateX(85deg); } to { opacity: 1; transform: rotateX(0); } }
@keyframes pop-flip-out { from { opacity: 1; transform: rotateX(0); } to { opacity: 0; transform: rotateX(-85deg); } }

.pop-list { list-style: none; margin: 0; padding: 0; perspective: 500px; }
.pop-list li a { display: flex; align-items: center; gap: 7px; padding: 6px; border-radius: 8px; color: inherit; text-decoration: none; }
.pop-list li.in a { animation: pop-flip-in 0.45s ease both; }
.pop-list li.out a { animation: pop-flip-out 0.24s ease both; }
@media (hover: hover) { .pop-list li a:hover { background: var(--primary-soft); } }
.pop-num { flex-shrink: 0; width: 17px; text-align: center; font-size: 13px; color: var(--text-muted); }
.pop-num.top { color: #ea3323; font-weight: 800; }   /* 1~3위 숫자 — 다홍빛 빨강 */
.pop-title { flex: 1; min-width: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pop-delta { flex-shrink: 0; min-width: 22px; text-align: right; font-size: 10px; font-weight: 700; }
.pop-delta.up { color: var(--price); }
.pop-delta.down { color: #3b82f6; }
.pop-delta.new { color: var(--primary-strong); }
.pop-delta.same { color: var(--text-muted); font-weight: 400; }

.pop-ticker { position: relative; margin: 0 0 12px; }   /* 좁은 화면(홈): 한 줄 플립 티커 */
.pop-ticker-bar {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.pop-ticker-label { flex-shrink: 0; font-size: 13px; font-weight: 800; color: var(--primary-strong); }
.pop-ticker-win { flex: 1; min-width: 0; height: 20px; overflow: hidden; perspective: 400px; }
.pop-ticker-item { display: block; height: 20px; line-height: 20px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pop-ticker-item.in { animation: pop-flip-in 0.3s ease both; }
.pop-ticker-item.out { animation: pop-flip-out 0.24s ease both; }
.pop-ticker-item b { color: #ea3323; margin-right: 5px; }   /* 티커 순위 숫자 — 다홍빛 빨강 */
.pop-ticker-bar > svg { flex-shrink: 0; width: 14px; height: 14px; color: var(--text-muted); }
.pop-ticker-panel {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 10px 10px 6px;
}
@media (min-width: 1320px) { .pop-ticker { display: none; } }

/* ── 찜 하트 (카드 이미지 우측 아래 + 상세 액션) ── */
.card-heart {
  position: absolute;
  right: 6px;
  bottom: 6px;
  z-index: 2;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.16);
  color: #8a8a8a;
  cursor: pointer;
}
.card-heart .ic-heart { width: 17px; height: 17px; }
.card-heart.on { color: #ff5160; }
.act-btn .ic-heart { width: 21px; height: 21px; }
.act-btn.heart-btn[aria-pressed="true"] { color: #ff5160; }
@media (hover: hover) { .act-btn.heart-btn:hover { color: #ff5160; } }
.heart-btn .ic-heart { pointer-events: none; }   /* 클릭 타깃을 버튼으로 고정 */

/* 토스트 액션 링크 (찜 → 보러가기) — 표시 중일 때만 부모의 pointer-events:none을 뚫고 클릭 가능
   (숨김 상태에서도 살아 있으면 투명 링크가 화면 하단 탭을 가로챔) */
.toast.show .toast-act { pointer-events: auto; }
.toast .toast-act {
  margin-left: 8px;
  padding: 6px 2px;          /* 모바일 탭 타깃 확보 */
  color: var(--primary);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* 총 상품 수 — 정렬 셀렉트 줄 맨 왼쪽 */
.deal-count {
  margin: 0 auto 10px 2px;   /* 오른쪽 auto → 셀렉트는 우측 유지 */
  align-self: center;
  font-size: 13px;
  color: var(--text-muted);
}
.deal-count b { color: var(--text); font-weight: 800; }

/* 모바일: 카테고리 전부 펼쳐서 표시 — 가로 스크롤은 발견성이 낮아 폐기 (2026-08-20, 되돌리기: git 이력) */
.cat-scroll-hint { display: none; }
@media (max-width: 480px) {
  .cat-filter .cat-chips {
    flex-wrap: wrap;
    height: auto !important;   /* 접힘(collapsed) 상태의 JS 실측 높이 무력화 — 항상 전체 노출 */
    overflow: visible;
  }
  .cat-filter .cat-toggle { display: none; }
  .toast { font-size: 13px; padding: 10px 15px; }   /* 모바일: 토스트 한 줄 유지용 축소 */
}
@keyframes cats-nudge-x {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(3px); }
}

/* 구매 클릭 후 추천 팝업 (쿠팡 후보 — '관련 핫딜'과 데이터 공유) */
.afterbuy-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;   /* 등장 애니메이션 없음 — 구매 클릭 순간 지연 0으로 떠야 함 */
}
.afterbuy-pop {
  width: 100%;
  max-width: 560px;
  max-height: 72vh;
  display: flex;               /* 헤더 고정 + 본문만 스크롤 */
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);              /* 배경보다 한 톤 밝게 — 야간모드에서 팝업이 떠 보이게 */
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 0 0 1px rgba(255, 255, 255, 0.04);   /* 야간: 외곽 미세 하이라이트 */
}
@media (max-width: 480px) {
  .afterbuy-pop { max-height: 58vh; }   /* 모바일: 화면 절반 수준 — 팝업임이 확실히 보이게 */
}
.afterbuy-head {
  flex-shrink: 0;              /* 스크롤과 무관하게 항상 상단 고정 */
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.afterbuy-head .related-title { flex: 1; margin: 0; font-size: 14px; line-height: 1.45; }
.afterbuy-home {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
  color: #fff;
  box-shadow: 0 3px 8px rgba(219, 100, 64, 0.35);
}
.afterbuy-home svg { width: 18px; height: 18px; }
.afterbuy-home:active { transform: scale(0.94); }
.afterbuy-body {
  overflow-y: auto;            /* 카드 목록만 스크롤 */
  padding: 12px 14px 14px;
}
.afterbuy-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}
.afterbuy-pop .state-msg { grid-column: 1 / -1; }   /* 후보 없음 안내 — 그리드 전체폭 */

/* ---------- 찜 바텀시트 (탭바 '찜' — 페이지 이동 없이 보던 화면 위로) ---------- */
.bm-sheet-overlay {
  position: fixed;
  inset: 0;
  bottom: calc(59px + env(safe-area-inset-bottom));   /* 탭바(패딩10+내용48+윗선1=59px)는 덮지 않는다 */
  z-index: 58;
  background: rgba(0, 0, 0, .42);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}
[data-theme="dark"] .bm-sheet-overlay { background: rgba(0, 0, 0, .6); }
.bm-sheet-overlay.show { opacity: 1; visibility: visible; }
.bm-sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-height: 78vh;                  /* dvh 미지원(구형 웹뷰) 폴백 */
  max-height: 78dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);   /* 야간모드에서 뒤 화면과 확실히 구분 */
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, .18);
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.32, .72, .24, 1);
}
[data-theme="dark"] .bm-sheet {
  border-color: #55483e;
  box-shadow: 0 -12px 44px rgba(0, 0, 0, .65);
}
.bm-sheet-overlay.show .bm-sheet { transform: translateY(0); }
.bm-sheet-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 18px 10px;           /* 위 여백은 드래그 핸들 자리 */
  touch-action: none;                /* 헤더 드래그(아래로 끌어 닫기) 전용 영역 */
}
.bm-sheet-grab {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
}
[data-theme="dark"] .bm-sheet-grab { background: #55483e; }
.bm-sheet-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 17px;
  font-weight: 800;
}
.bm-sheet-title .ic-heart { width: 19px; height: 19px; color: #ff5160; }
.bm-sheet-count { color: var(--text-muted); font-weight: 700; font-size: 15px; }
.bm-sheet-close {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}
.bm-sheet-body {
  overflow-y: auto;
  overscroll-behavior: contain;      /* 시트 스크롤이 뒤 페이지로 안 새게 */
  padding: 2px 14px 18px;            /* 탭바가 아래 있으니 safe-area 여백 불필요 */
}

/* ---------- 모바일 하단 탭바 ---------- */
.bottom-nav {
  display: none;                    /* 모바일에서만 표시 (아래 미디어쿼리) */
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 59;                      /* 찜 시트(58)보다 위 — 탭바와 윗선은 항상 노출, 토스트(60) 아래 */
  grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding: 5px 6px calc(5px + env(safe-area-inset-bottom));
}
.bnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;                 /* 터치 타깃 */
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: -0.1px;
  -webkit-tap-highlight-color: transparent;
}
button.bnav-item {                  /* '앱 설치' 탭 — 링크 탭과 동일한 생김새 */
  border: 0;
  background: transparent;
  padding: 0;
  font-family: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}
.bnav-item svg { width: 23px; height: 23px; }
/* .bnav-item .ic-heart { color: #ff5160; }   찜 하트는 어디서든 시그니처 색 */
.bnav-item:active { background: var(--surface-2); }
.bnav-item.is-active { color: var(--text); font-weight: 700; }
@media (max-width: 767px) {
  .bottom-nav { display: grid; }
  body { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }   /* 탭바에 본문·푸터 안 가리게 */
  .to-top { bottom: calc(72px + env(safe-area-inset-bottom)); }        /* 위로가기 버튼을 탭바 위로 */
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }         /* 토스트도 탭바 위로 */
  .buy-bar { bottom: calc(60px + env(safe-area-inset-bottom)); }       /* 상세 구매 바: 떠다닐 때 탭바 위에 정착 */
}

/* ---------- 상세: 조회 소셜 문구 · 시세 비교표 · 실시간 배지 ---------- */
.view-social {
  margin: 2px 0 10px;
  font-size: 13px;
  color: var(--text-muted);
}
.view-social b { color: #ff5160; font-weight: 800; }

.compare-wrap { overflow-x: auto; }
.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.compare-table th, .compare-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
.compare-table th { color: var(--text-muted); font-weight: 700; font-size: 12px; }
.compare-table td:nth-child(2) { white-space: normal; min-width: 170px; }
.compare-table td:nth-child(2) a { text-decoration: underline; text-underline-offset: 3px; }
.compare-note { font-size: 11.5px; color: var(--text-muted); margin: 8px 2px 0; }

.live-badge {
  display: inline-block;
  vertical-align: middle;
  margin-left: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(100deg, #ff5160, #ee7d5a, #ff5160);
  background-size: 200% 100%;
  animation: live-shine 2.2s linear infinite;
  box-shadow: 0 2px 10px rgba(255, 81, 96, 0.35);
  white-space: nowrap;
}
@keyframes live-shine { to { background-position: -200% 0; } }

/* "N명이 봤어요" 말풍선 — 입장 직후 화면 중간에 잠깐 (토스트와 별개, 클릭 방해 없음) */
.views-bubble {
  position: fixed;
  left: 50%;
  bottom: 96px;                  /* 구매 버튼 바로 위 — 실제 위치는 JS가 구매바 높이로 보정 */
  transform: translate(-50%, 10px) scale(0.95);
  z-index: 70;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
/* 구매바 안에 붙여 스티키 동작을 그대로 따라감 (버튼이 멈추면 말풍선도 같이 멈춤) */
.buy-bar .views-bubble { position: absolute; bottom: calc(100% + 12px); }
.views-bubble.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.views-bubble b { color: #ff5160; }
.views-bubble::after {          /* 말풍선 꼬리 */
  content: '';
  position: absolute;
  left: 50%;
  bottom: -8px;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-bottom: 0;
  border-top: 8px solid var(--surface);
}

/* 상세 하단 — 발굴 단추 아래, 같은 크기로 홈 복귀. 색은 사이트의 포근한 살구·테라코타 */
.home-return {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; margin: 20px 0 0; padding: 12px 18px;
  border: 1px solid var(--primary-soft); border-radius: 14px;
  background: var(--primary-soft); color: var(--primary-strong);
  font-size: 15px; font-weight: 700; text-decoration: none;
  box-shadow: var(--shadow-sm);
}
.home-return b { font-weight: 800; }
.home-return:active { filter: brightness(.96); }
@media (hover: hover) { .home-return:hover { background: var(--accent-soft); } }
