:root {
  --bg: #ffffff;
  --bg-soft: #f3f3f3;
  --text: #2b2b2b;
  --muted: #8a8a8a;
  --line: #e7e7e7;
  --accent: #1f6feb;        /* 파란 CTA */
  --accent-dark: #1a5fce;
  --badge: #3a3f47;         /* 세일! 뱃지 */
  --star: #f4b400;
  --maxw: 1180px;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.05);
  --font: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard",
          "Malgun Gothic", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.logo {
  font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em;
}
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  padding: 8px 12px; border-radius: 999px;
  color: var(--muted); font-size: .95rem; font-weight: 600;
  transition: background .15s, color .15s;
}
.nav a:hover { color: var(--text); background: var(--bg-soft); }
.nav a.active { color: #fff; background: var(--text); }
.nav-toggle {
  display: none; background: none; border: 0; font-size: 1.4rem; cursor: pointer;
}

/* ---------- Hero ---------- */
.hero {
  position: relative; color: #fff;
  background: #3a3a3a center/cover no-repeat;
  min-height: 340px; display: flex; align-items: center;
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,.55), rgba(0,0,0,.15));
}
.hero-inner { position: relative; padding: 56px 0; }
.hero h1 {
  margin: 0 0 14px; font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800; letter-spacing: -.02em; text-shadow: 0 2px 12px rgba(0,0,0,.3);
}
.hero p { margin: 0 0 28px; font-size: clamp(1rem, 2.2vw, 1.3rem); opacity: .95; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-block; padding: 13px 26px; border-radius: 4px;
  font-weight: 700; font-size: .95rem; cursor: pointer; border: 2px solid transparent;
  transition: transform .12s, background .15s, color .15s;
}
.btn:active { transform: translateY(1px); }
.btn-solid { background: #fff; color: #222; }
.btn-solid:hover { background: #f0f0f0; }
.btn-ghost { border-color: rgba(255,255,255,.85); color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,.15); }

/* ---------- Section ---------- */
.section { padding: 56px 0 72px; }
.section-title { text-align: center; margin-bottom: 8px; }
.section-title h2 { margin: 0; font-size: 1.9rem; font-weight: 800; letter-spacing: -.01em; }
.section-title .rule { width: 56px; height: 3px; background: var(--text); margin: 14px auto 0; border-radius: 2px; }

/* ---------- Search bar ---------- */
.search-bar { display: flex; justify-content: center; margin: 28px 0 4px; }
.search-bar input {
  width: 100%; max-width: 440px; padding: 12px 18px;
  border: 1px solid var(--line); border-radius: 999px; background: #fff;
  font-size: .98rem; font-family: var(--font); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.search-bar input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31,111,235,.12);
}
.search-bar input::placeholder { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 12px 0 4px; }
.chip {
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
  border: 1px dashed var(--accent); background: rgba(31,111,235,.06); color: var(--accent);
  font-size: .85rem; font-weight: 600; transition: background .15s;
}
.chip:hover { background: rgba(31,111,235,.14); }
.suggest-msg {
  text-align: center; font-size: 1.05rem; font-weight: 700; color: var(--text);
  margin: 8px 0 26px;
}
.ai-row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 14px 0 2px; }
.ai-toggle {
  padding: 7px 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--accent); background: #fff; color: var(--accent);
  font-size: .85rem; font-weight: 700; transition: all .15s;
}
.ai-toggle:hover { background: rgba(31,111,235,.08); }
.ai-toggle.on { background: var(--accent); color: #fff; }
.ai-status { font-size: .82rem; color: var(--muted); }

/* ---------- 나를 위한 추천 ---------- */
.picks { padding-bottom: 8px; }
.picks-sub { text-align: center; color: var(--muted); font-size: .92rem; margin: 10px 0 26px; }

/* 가로 캐러셀 */
.carousel-wrap { position: relative; }
.carousel {
  display: flex; gap: 18px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 4px 2px 12px; -webkit-overflow-scrolling: touch; scrollbar-width: thin;
}
.carousel::-webkit-scrollbar { height: 6px; }
.carousel::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.carousel .card { flex: 0 0 200px; scroll-snap-align: start; }
.carousel .card:hover { transform: translateY(-4px); }
.carousel-btn {
  position: absolute; top: calc(50% - 26px); transform: translateY(-50%); z-index: 5;
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line); background: rgba(255,255,255,.96); color: var(--text);
  font-size: 1.4rem; line-height: 1; display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow); transition: opacity .15s, background .15s;
}
.carousel-btn:hover { background: #fff; }
.carousel-btn.prev { left: -8px; }
.carousel-btn.next { right: -8px; }
.carousel-btn.hidden { opacity: 0; pointer-events: none; }
@media (max-width: 760px) {
  .carousel .card { flex-basis: 150px; }
  .carousel-btn { display: none; }
}

/* ---------- 페이지 전체 2단 (본문 + 우측 레일) ---------- */
.page { display: flex; gap: 34px; align-items: flex-start; }
#app { flex: 1 1 auto; min-width: 0; }
/* 본문 섹션은 이미 .page가 컨테이너 역할을 하므로 중첩 .container를 무력화 */
#app .container { max-width: none; padding: 0; }
/* 히어로는 좌측 컬럼 안에서 라운드 카드로 */
#app .hero { border-radius: var(--radius); overflow: hidden; min-height: 300px; }
#app .hero::before { border-radius: var(--radius); }
.products-section { padding: 44px 0 64px; }

.rail { flex: 0 0 296px; padding-top: 44px; position: sticky; top: 84px; }

.side-box {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 18px 20px; margin-bottom: 22px;
}
.side-box h3 { margin: 0 0 4px; font-size: 1.05rem; font-weight: 800; }

/* 핫딜 사이드박스 */
.side-deals { background: linear-gradient(180deg, #fbf5ea, #fff 60%); border-color: #efe3cd; }
.side-note { margin: 0 0 14px; font-size: .8rem; color: var(--muted); line-height: 1.5; }
.side-note strong { color: #a9762e; font-weight: 700; }
.side-deal-list { display: flex; flex-direction: column; gap: 12px; }
.side-deal {
  display: flex; gap: 11px; align-items: center; text-decoration: none; color: inherit;
  border-radius: 8px; padding: 5px; margin: -5px; transition: background .12s;
}
.side-deal:hover { background: rgba(185,138,82,.09); }
.side-deal-thumb {
  flex: 0 0 56px; width: 56px; height: 56px; border-radius: 8px; overflow: hidden;
  background: var(--bg-soft); border: 1px solid var(--line);
}
.side-deal-thumb img { width: 100%; height: 100%; object-fit: cover; }
.side-deal-info { min-width: 0; }
.side-deal-name {
  margin: 0; font-size: .86rem; font-weight: 600; line-height: 1.32; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.side-deal-price { margin: 3px 0 0; font-size: .92rem; font-weight: 800; color: #c0392b; }
.side-deal-rocket { font-size: .8rem; }
.side-time { margin: 14px 0 0; font-size: .72rem; color: var(--muted); text-align: right; }

/* 쿠팡 검색 사이드박스 */
.side-search p { margin: 0 0 12px; font-size: .82rem; color: var(--muted); }
.side-search iframe { max-width: 100%; }

@media (max-width: 900px) {
  .page { flex-direction: column; gap: 0; }
  .rail { position: static; flex-basis: auto; width: 100%; padding-top: 0; padding-bottom: 40px; }
  .products-section { padding-bottom: 40px; }
}

/* ---------- Filter tabs ---------- */
.filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 28px 0 36px; }
.filters button {
  padding: 8px 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  font-size: .9rem; font-weight: 600; transition: all .15s;
}
.filters button:hover { color: var(--text); border-color: #ccc; }
.filters button.active { background: var(--text); color: #fff; border-color: var(--text); }

/* ---------- Product grid ---------- */
.grid {
  display: grid; gap: 26px 22px;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}
.card {
  position: relative; cursor: pointer;
  display: flex; flex-direction: column;
  transition: transform .15s;
}
.card:hover { transform: translateY(-4px); }
.card-thumb {
  position: relative; aspect-ratio: 1/1; overflow: hidden;
  border-radius: var(--radius); background: var(--bg-soft);
  box-shadow: var(--shadow);
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.card:hover .card-thumb img { transform: scale(1.04); }
.badge-sale {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--badge); color: #fff; font-size: .8rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.card-body { padding: 14px 2px 0; }
.card-name { font-size: .98rem; font-weight: 600; margin: 0 0 6px; line-height: 1.4; }
.card-note {
  font-size: .82rem; color: #5a5a5a; margin: 0 0 6px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-cat { font-size: .8rem; color: var(--muted); margin: 0 0 6px; }
.card-price { font-size: .95rem; }
.card-price .orig { color: var(--muted); text-decoration: line-through; margin-right: 6px; font-size: .85rem; }
.card-price .now { font-weight: 700; }
.card-price .now.muted { color: var(--accent); font-weight: 700; }
.badge-platform {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  padding: 4px 9px; border-radius: 6px; font-size: .72rem; font-weight: 800; letter-spacing: -.01em;
  background: #ff4747; color: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.detail-img { position: relative; }
.badge-wish {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  padding: 5px 11px; border-radius: 999px; font-size: .75rem; font-weight: 800;
  background: #6b4ee6; color: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.stars { color: var(--star); font-size: .85rem; letter-spacing: 1px; margin-top: 6px; opacity: .85; }

/* ---------- Empty ---------- */
.empty { text-align: center; color: var(--muted); padding: 60px 0; }

/* ---------- Detail ---------- */
.detail { padding: 40px 0 72px; }
.breadcrumb { font-size: .85rem; color: var(--muted); margin-bottom: 24px; }
.breadcrumb a:hover { color: var(--text); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.detail-img { border-radius: var(--radius); background: var(--bg-soft); box-shadow: var(--shadow); overflow: hidden; }
.detail-img img { width: 100%; aspect-ratio: 1/1; object-fit: contain; }
.detail h1 { margin: 0 0 14px; font-size: 1.7rem; font-weight: 800; letter-spacing: -.01em; }
.detail-summary {
  margin: 0 0 18px; padding: 11px 14px; border-radius: 8px;
  background: rgba(31,111,235,.06); border-left: 3px solid var(--accent);
  font-size: .95rem; font-weight: 600; color: #344; line-height: 1.5;
}
.detail-price { font-size: 1.5rem; margin-bottom: 22px; }
.detail-price .orig { color: var(--muted); text-decoration: line-through; font-size: 1.05rem; margin-right: 10px; }
.detail-price .now { font-weight: 800; }
.cta {
  display: inline-block; width: 100%; text-align: center;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 1.05rem;
  padding: 15px 24px; border-radius: 6px; transition: background .15s, transform .12s;
}
.cta:hover { background: var(--accent-dark); }
.cta:active { transform: translateY(1px); }
.detail-cat { margin-top: 18px; font-size: .9rem; color: var(--muted); }
.detail-desc { margin-top: 40px; padding-top: 32px; border-top: 1px solid var(--line); }
.detail-desc h3 { font-size: 1.1rem; margin: 0 0 16px; }
.detail-desc p { white-space: pre-wrap; color: #444; }
.detail-chart { margin-top: 40px; padding-top: 32px; border-top: 1px solid var(--line); }
.detail-chart h3 { font-size: 1.1rem; margin: 0 0 16px; }
.pricechart { width: 100%; max-width: 600px; height: auto; display: block; }
.pricechart .axis { stroke: var(--line); stroke-width: 1; }
.pricechart .axisl { fill: var(--muted); font-size: 13px; font-family: var(--font); }
.chart-note { font-size: .9rem; color: var(--muted); margin: 10px 0 0; }
.detail-blog { margin-top: 20px; font-weight: 600; }
.detail-blog a { color: var(--accent); text-decoration: underline; }
.detail-blog a:hover { color: var(--accent-dark); }

/* ---------- 쿠팡 검색바 ---------- */
.coupang-search { border-top: 1px solid var(--line); background: #fafafa; padding: 30px 0; }
.coupang-search .container { max-width: 620px; text-align: center; }
.coupang-search h3 { margin: 0 0 6px; font-size: 1.1rem; font-weight: 800; }
.coupang-search p { margin: 0 0 16px; font-size: .9rem; color: var(--muted); }
.coupang-search iframe { max-width: 520px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-soft); padding: 32px 0; margin-top: 40px; }
.disclosure { font-size: .82rem; color: var(--muted); margin: 0 0 10px; }
.copyright { font-size: .82rem; color: var(--muted); margin: 0; }
.copyright a:hover { color: var(--text); }

.loading { padding: 80px 0; text-align: center; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .nav {
    display: none; position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; gap: 0; background: #fff;
    border-bottom: 1px solid var(--line); padding: 8px 12px;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px; border-radius: 6px; }
  .nav-toggle { display: block; }
  .detail-grid { grid-template-columns: 1fr; gap: 28px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px 16px; }
}
