@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700;900&family=Bebas+Neue&display=swap');

:root {
  --primary: #E8773A;
  --primary-dark: #2D3436;
  --bg: #F5F5F0;
  --card-bg: #FFFFFF;
  --text: #1A1A1A;
  --text-muted: #888;
  --rocket: #E8773A;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Noto Sans KR', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; max-width: 480px; margin: 0 auto; }
header { background: var(--primary); color: white; padding: 12px 16px 10px; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,0.2); width: 100%; box-sizing: border-box; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.logo { font-family: 'Bebas Neue', sans-serif; font-size: 26px; letter-spacing: 1px; line-height: 1; white-space: nowrap; }
.header-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.badge { background: rgba(255,255,255,0.18); padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; color: #FFE066; white-space: nowrap; }
.update-time { font-size: 10px; color: rgba(255,255,255,0.65); white-space: nowrap; }
.weekly-picks { background: linear-gradient(135deg, #1A1A1A 0%, #333 100%); color: white; padding: 14px 16px; }
.weekly-label { font-size: 12px; font-weight: 700; color: #FFE066; display: block; margin-bottom: 10px; }
.weekly-products { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.weekly-products::-webkit-scrollbar { display: none; }
.weekly-card { flex-shrink: 0; display: flex; gap: 8px; background: rgba(255,255,255,0.07); border-radius: 10px; padding: 10px; width: 240px; cursor: pointer; align-items: center; }
.weekly-img { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.weekly-info { flex: 1; min-width: 0; }
.weekly-name { font-size: 12px; color: white; line-height: 1.4; margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.weekly-price { font-size: 13px; font-weight: 700; color: #FFE066; margin-bottom: 2px; }
.weekly-rocket { font-size: 10px; color: #4FC3F7; }
.ad-banner { margin: 10px 16px; border-radius: 10px; overflow: hidden; display: none; }
.ad-banner img { width: 100%; display: block; }
.category-tabs { background: white; overflow-x: auto; scrollbar-width: none; display: flex; position: static; box-shadow: 0 2px 6px rgba(0,0,0,0.06); border-bottom: 1px solid #eee;  }
.category-tabs::-webkit-scrollbar { display: none; }
.tab { flex-shrink: 0; padding: 11px 14px; border: none; background: none; font-size: 12px; font-weight: 600; color: #999; cursor: pointer; white-space: nowrap; border-bottom: 3px solid transparent; transition: all 0.2s; font-family: 'Noto Sans KR', sans-serif; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.subtab-nav { background: #fafafa; padding: 8px 16px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid #eee; }
.subtab-nav::-webkit-scrollbar { display: none; }
.subtab { flex-shrink: 0; padding: 5px 12px; border-radius: 20px; border: 1.5px solid #e0e0e0; background: white; font-size: 12px; font-weight: 500; color: #666; cursor: pointer; white-space: nowrap; font-family: 'Noto Sans KR', sans-serif; transition: all 0.2s; }
.subtab.active { background: var(--primary); border-color: var(--primary); color: white; font-weight: 700; }
.curation-box { padding: 0 16px; margin: 12px 0 4px; }
.curation-comment { background: #FFF8E7; border-left: 3px solid #FFB800; border-radius: 0 10px 10px 0; padding: 12px 14px; }
.curation-label { font-size: 12px; font-weight: 700; color: #E8320A; margin-bottom: 6px; }
#curation-text { font-size: 13px; line-height: 1.6; color: #333; }
.product-grid { padding: 10px 16px 80px; display: flex; flex-direction: column; gap: 10px; }
.loading { text-align: center; padding: 60px; color: var(--text-muted); font-size: 14px; }
.card { background: var(--card-bg); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 12px; transition: transform 0.15s; position: relative; }
.card:active { transform: scale(0.98); }
.card-img { width: 90px; height: 90px; object-fit: cover; border-radius: 10px; background: #f0f0f0; flex-shrink: 0; }
.card-body { flex: 1; min-width: 0; }
.card-rank { font-size: 10px; font-weight: 900; color: var(--primary); margin-bottom: 3px; }
.card-name { font-size: 13px; font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 6px; color: #1a1a1a; }
.card-meta { display: flex; align-items: center; gap: 6px; margin: 4px 0; flex-wrap: wrap; }
.card-price { font-size: 16px; font-weight: 900; color: var(--primary); margin-bottom: 6px; }
.card-footer { display: flex; align-items: center; gap: 6px; }
.rocket-badge { background: #1A73E8; color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 700; }
.free-badge { background: #16A34A; color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 700; }
.coupang-btn { display: inline-block; background: var(--primary); color: white; padding: 5px 12px; border-radius: 6px; font-size: 11px; font-weight: 700; text-decoration: none; margin-left: auto; white-space: nowrap; }
footer { background: #222; color: rgba(255,255,255,0.5); text-align: center; padding: 20px 16px; font-size: 11px; line-height: 1.7; }

/* ── PC 레이아웃 (768px 이상) ── */
@media (min-width: 768px) {
  body { max-width: 900px; }
  .product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    padding: 16px 16px 80px;
  }
  .card { flex-direction: column; padding: 0; }
  .card-img { width: 100%; height: 200px; border-radius: 14px 14px 0 0; }
  .card-body { padding: 14px; width: 100%; }
  .card-price { font-size: 18px; }
  .category-tabs { top: 60px; }
  .tab { font-size: 13px; padding: 12px 18px; }
  .header-inner { padding: 0; }
  .logo { font-size: 30px; }
  .badge { font-size: 12px; }
  .weekly-card { width: 280px; }
}

/* 카테고리 탭 화살표 (PC 전용) */
.category-tabs-wrapper {
  display: flex;
  align-items: center;
  position: sticky;
  top: 54px;
  z-index: 90;
  background: white;
  border-bottom: 1px solid #eee;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.category-tabs-wrapper .category-tabs {
  position: static;
  z-index: auto;
  box-shadow: none;
  border-bottom: none;
  flex: 1;
}
.tab-arrow {
  flex-shrink: 0;
  width: 28px;
  height: 44px;
  border: none;
  background: white;
  font-size: 22px;
  color: #555;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.tab-arrow:hover { background: #f5f5f5; color: var(--primary); }
@media (min-width: 768px) {
  .tab-arrow { display: flex; }
}

/* 모바일 subtab-nav 고정 */
@media (max-width: 767px) {
  .subtab-nav { top: 137px; }
}

/* 모바일 1차 카테고리 고정 */
@media (max-width: 767px) {
  .category-tabs-wrapper {
    position: sticky;
    top: 94px;
    z-index: 90;
  }
}

@media (min-width: 768px) {
  header, .category-tabs-wrapper {
    max-width: 900px;
    margin: 0 auto;
    left: 0;
    right: 0;
  }
}
/* ── 시즌 배너 ── */
.season-banner { width: 100%; padding: 0; }
.season-banner-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px; }
.season-text { flex: 1; min-width: 0; }
.season-title { font-size: 15px; font-weight: 800; line-height: 1.3; }
.season-subtitle { font-size: 12px; line-height: 1.4; margin-top: 4px; opacity: 0.85; }
.season-close { width: 28px; height: 28px; border: none; background: rgba(0,0,0,0.08); color: inherit; border-radius: 50%; font-size: 18px; line-height: 1; cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.season-close:hover { background: rgba(0,0,0,0.18); }
@media (min-width: 768px) {
  .season-title { font-size: 17px; }
  .season-subtitle { font-size: 13px; }
}

/* ── 이번 주 급상승 ── */
.rising-section { background: #fff; padding: 14px 16px 12px; border-top: 1px solid #f0f0f0; }
.rising-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; background: none; border: none; padding: 0; margin-bottom: 10px; cursor: pointer; font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
.rising-toggle .rising-label { margin-bottom: 0; }
.rising-label { font-size: 13px; font-weight: 800; color: #FF4444; margin-bottom: 10px; }
.rising-grid { display: flex; gap: 10px; overflow: hidden; max-height: 1200px; transition: max-height 0.35s ease, opacity 0.25s ease; opacity: 1; }
.rising-section.collapsed .rising-grid { max-height: 0; opacity: 0; }
.rising-section.collapsed .rising-toggle { margin-bottom: 0; }
.rising-card { flex: 1 1 0; min-width: 0; background: #FFF8F8; border: 1px solid #FFE0E0; border-radius: 12px; padding: 10px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; transition: transform 0.15s; }
.rising-card:active { transform: scale(0.98); }
.rising-img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 8px; background: #f0f0f0; }
.rising-body { display: flex; flex-direction: column; gap: 4px; }
.rising-cat { font-size: 10px; color: #888; font-weight: 600; }
.rising-name { font-size: 12px; font-weight: 600; line-height: 1.4; color: #1a1a1a; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rising-meta { margin-top: 2px; }
.rising-delta { display: inline-block; font-size: 10px; font-weight: 700; padding: 3px 7px; border-radius: 10px; }
.rising-delta-up { background: #FF4444; color: #fff; }
.rising-delta-new { background: #16A34A; color: #fff; }
.rising-link { font-size: 11px; font-weight: 700; color: #fff; background: var(--primary); text-align: center; padding: 6px 0; border-radius: 6px; text-decoration: none; margin-top: 4px; }

/* 모바일 — 세로 스택 */
@media (max-width: 767px) {
  .rising-grid { flex-direction: column; }
  .rising-card { flex-direction: row; align-items: center; }
  .rising-img { width: 80px; height: 80px; aspect-ratio: 1/1; flex-shrink: 0; }
  .rising-body { flex: 1; min-width: 0; }
  .rising-link { align-self: stretch; max-width: none; }
}

/* ── 카드 뱃지 (STEP 2: 순위변동 / STEP 3: 카테고리 순위) ── */
.card-badge-left,
.card-badge-right {
  position: absolute;
  top: 8px;
  z-index: 5;
  pointer-events: none;
  display: flex;
  gap: 4px;
}
.card-badge-left { left: 8px; }
.card-badge-right { right: 8px; }
.rank-badge,
.change-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 10px;
  line-height: 1.3;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.rank-badge-top { background: #FF4444; color: #fff; }
.rank-badge-verified { background: #F59E0B; color: #fff; }
.rank-badge-new { background: #16A34A; color: #fff; }
.change-badge { background: #fff; }
.change-up { color: #FF4444; border: 1px solid #FFD0D0; }
.change-down { color: #4444FF; border: 1px solid #D0D0FF; }
.change-new { color: #16A34A; border: 1px solid #BFE9C9; }

/* PC 그리드 카드(세로형) — 이미지 위에 뱃지가 떠 있도록 위치 동일 */
@media (min-width: 768px) {
  .card-badge-left, .card-badge-right { top: 10px; }
  .rank-badge, .change-badge { font-size: 11px; padding: 4px 8px; }
}
