/* =============================================================
   핫딜러샵 스타일
   - 모바일 우선(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: #241d18;
  --surface-2: #2e251f;
  --text: #f1e9df;
  --text-muted: #b3a797;
  --primary: #f0875f;
  --primary-strong: #f6a282;
  --primary-ink: #2a160d;
  --primary-soft: #3a2a21;
  --accent: #ef7d5d;
  --accent-soft: #3a261f;
  --price: #ff4d57;         /* 가격 — 다크모드용 밝은 빨강 */
  --border: #3a302a;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 3px 12px rgba(0, 0, 0, 0.38);
}

* { 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: 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-cap { font-size: 1.25em; }

.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 { font-size: 17px; }

/* 데스크탑(마우스): 호버 시 자동으로 펼침. 모바일(터치)은 탭으로 동작 */
@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; }
  .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; }
  .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); }

/* 정렬 셀렉트 — 카테고리 필터 아래·상품 리스트 위, 우측 정렬 */
.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: 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); }

/* 상세 하단 관련 핫딜 */
.related-section { margin-top: 28px; }
.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: 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;
}
.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;
}
.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); }
.discount-chip:hover { border-color: var(--accent); }
.discount-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* 무한스크롤 보조 */
.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: 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: 9px 12px;
  font-size: 12px;
  line-height: 1.45;
  text-align: left;
  color: var(--text);
  background: var(--surface-2);
  border-radius: 8px;
}

/* 구매 바: 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; }

.bookmark-card { position: relative; }
.deal-card-link { display: flex; flex-direction: column; width: 100%; min-width: 0; color: inherit; }
.remove-bm {
  position: absolute;
  top: 8px; left: 8px;
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  color: var(--text);
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 1px 5px rgba(0, 0, 0, .15);
  z-index: 2;
}
.remove-bm:hover { color: var(--accent); }
.remove-bm .ic { width: 17px; height: 17px; }

/* ---------- 정적 문서 페이지(약관 등) ---------- */
.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; }

/* ---------- 푸터 ---------- */
.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;
  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); }

/* ---------- 넓은 화면: 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; }
}
