/* ============================================================
   세일밤 웹 v1
   색·모양은 세일밤 iOS 화면(ios/Screenshots/sb-*.jpg)을 따른다: 옅은 회색 바탕 + 흰 둥근 카드(모서리 22px),
   강조색은 세일밤 빨강 하나, 내림은 초록, 와우는 파랑, 카드 혜택은 초록 칩.
   토큰 구조는 삼성 대시보드(--d-*)를 참고해 --s-* 로 둔다. 한쪽만 굵은 테두리 장식은 쓰지 않는다.
   ============================================================ */

:root {
  /* 무채색(zinc) */
  --s-gray-50: #fafafa; --s-gray-100: #f4f4f5; --s-gray-200: #e4e4e7; --s-gray-300: #d4d4d8; --s-gray-400: #a1a1aa;
  --s-gray-500: #71717a; --s-gray-600: #52525b; --s-gray-700: #3f3f46; --s-gray-800: #27272a; --s-gray-900: #18181b;
  --s-ink: #111114; --s-body: var(--s-gray-800); --s-soft: #6e6e73;
  --s-line: #ececf0; --s-card: #fff; --s-page: #f2f2f7; --s-paper: #ebebf0;

  /* 강조색은 세일밤 빨강 하나 */
  --s-accent: #e8432e; --s-accent-deep: #c7311e; --s-accent-pale: #fdecea;
  /* 의미색: 초록 = 내림·최저, 빨강 = 오름, 파랑 = 와우 */
  --s-down: #15803d; --s-down-pale: #e3f5ea;
  --s-up: #c7311e; --s-up-pale: #fdecea;
  --s-wow: #2459d6; --s-wow-pale: #e8effd;
  --s-cardc: #1a8a4a; --s-cardc-pale: #e5f4ea;

  --s-radius: 22px; --s-radius-sm: 14px; --s-pill: 999px;
  --s-sans: Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --s-ease: cubic-bezier(.25, 1, .5, 1);
  --s-float: 0 8px 24px rgba(17, 17, 20, .14);
  --s-gutter: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--s-sans); font-size: 15px; line-height: 1.5; letter-spacing: -.01em;
  color: var(--s-body); background: var(--s-page);
  word-break: keep-all; overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { color: var(--s-ink); margin: 0; letter-spacing: -.02em; }
p { margin: 0; }
img { display: block; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.muted { color: var(--s-soft); }
.small { font-size: 13px; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:is(a, button):focus-visible { outline: 2px solid var(--s-accent); outline-offset: 2px; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 var(--s-gutter); }

/* ---------- 머리 ---------- */
.topbar { position: sticky; top: 0; z-index: 10; background: rgba(242, 242, 247, .86); backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px); }
.topbar-in { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-size: 20px; font-weight: 800; color: var(--s-ink); letter-spacing: -.03em; }
.logo-mark { display: block; flex: none; }

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 20px; border: 0; border-radius: var(--s-radius-sm);
  font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: background-color .15s var(--s-ease), transform .1s var(--s-ease);
}
.btn:active { transform: scale(.98); }
.btn[disabled] { cursor: default; opacity: .7; }
.btn-primary { background: var(--s-accent); color: #fff; }
.btn-primary:hover { background: var(--s-accent-deep); }
.btn-soft { background: var(--s-card); color: var(--s-ink); box-shadow: inset 0 0 0 1px var(--s-line); }
.btn-soft:hover { background: var(--s-gray-50); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; border-radius: var(--s-pill); }
.btn-block { width: 100%; }
.spinner { display: none; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: spin .8s linear infinite; }
.is-busy .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }

/* ---------- 카드·칩·배지 ---------- */
.card { background: var(--s-card); border-radius: var(--s-radius); padding: 20px; }
.card + .card, .actions + .card { margin-top: 14px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.card-title { font-size: 19px; font-weight: 800; }
.sub-title { font-size: 15px; font-weight: 700; margin: 18px 0 8px; color: var(--s-ink); }
.label { font-size: 14px; color: var(--s-soft); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 8px; }
.chip { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: var(--s-pill); font-size: 13px; font-weight: 700; }
.chip-wow { background: var(--s-wow-pale); color: var(--s-wow); }
.chip-card { background: var(--s-cardc-pale); color: var(--s-cardc); }
.chip-coupon, .chip-instant { background: var(--s-accent-pale); color: var(--s-accent-deep); }

.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.badge { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: var(--s-pill); font-size: 14px; font-weight: 800; }
.badge-low, .badge-down { background: var(--s-down-pale); color: var(--s-down); }
.badge-up { background: var(--s-up-pale); color: var(--s-up); }

/* ---------- 상품 페이지 ---------- */
.product-layout { display: grid; gap: 14px; padding: 8px 0 8px; }
.product-layout > .col { min-width: 0; }
.product-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.thumb { width: 96px; height: 96px; border-radius: 20px; object-fit: cover; background: #fff; flex: none; }
.thumb-empty { display: block; background: var(--s-paper); }
.mall-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--s-pill); background: #d62b20; color: #fff; font-size: 12px; font-weight: 800; }
.product-title { font-size: 19px; line-height: 1.35; font-weight: 700; margin: 6px 0 2px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.price-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; }
.price-big { font-size: 40px; line-height: 1.1; font-weight: 800; color: var(--s-ink); letter-spacing: -.03em; }
.price-mid { font-size: 30px; font-weight: 800; color: var(--s-ink); }
.price-strike { font-size: 18px; color: var(--s-gray-400); }
.soldout { color: var(--s-gray-500); }

.stat-row, .stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 16px 0 0; padding-top: 16px; border-top: 1px solid var(--s-line); }
.stat-row dt, .stat-grid dt { font-size: 13px; color: var(--s-soft); }
.stat-row dd, .stat-grid dd { margin: 2px 0 0; font-size: 17px; font-weight: 800; color: var(--s-ink); }
.stat-grid { border-top: 0; padding-top: 0; margin: 14px 0 12px; }

.actions { display: grid; gap: 10px; margin-top: 14px; }
.buy-form { margin: 0; }
.disclosure { font-size: 12px; color: var(--s-soft); text-align: center; padding: 0 8px; }

.matrix { width: 100%; border-collapse: collapse; margin: 12px 0 10px; font-size: 15px; }
.matrix th, .matrix td { padding: 10px 6px; text-align: right; border-bottom: 1px solid var(--s-line); }
.matrix thead th { font-size: 13px; font-weight: 600; color: var(--s-soft); }
.matrix th[scope="row"], .matrix thead th:first-child { text-align: left; font-weight: 600; color: var(--s-ink); }
.matrix tbody tr:last-child > * { border-bottom: 0; }
.matrix .is-best { color: var(--s-down); font-weight: 800; }

.segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; margin: 14px 0 10px; background: var(--s-gray-100); border-radius: var(--s-pill); }
.seg { height: 36px; border: 0; border-radius: var(--s-pill); background: transparent; font: inherit; font-size: 15px; font-weight: 600; color: var(--s-gray-700); cursor: pointer; }
.seg.is-on { background: #fff; color: var(--s-ink); box-shadow: 0 1px 4px rgba(17, 17, 20, .1); }
.chart-box { position: relative; height: 260px; }

.timing-head { font-size: 20px; font-weight: 800; color: var(--s-ink); margin-top: 10px; }
.timing-head.is-low { color: var(--s-down); }

.rows { margin: 10px 0 0; }
.rows .row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; }
.rows dt { color: var(--s-body); }
.rows dd { margin: 0; font-weight: 700; color: var(--s-ink); }
.offers { list-style: none; margin: 0; padding: 0; }
.offers li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--s-line); }
.offers li:first-child { border-top: 0; }

.app-card-top { display: flex; gap: 14px; align-items: flex-start; }
.app-card-top .card-title { margin-bottom: 4px; }
.app-actions { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 16px; }

/* ---------- 첫 화면 ---------- */
.hero { padding: 28px 0 22px; }
.hero h1 { font-size: 30px; line-height: 1.28; font-weight: 800; letter-spacing: -.035em; }
.hero p { margin-top: 12px; font-size: 16px; max-width: 34em; }
.hero strong { color: var(--s-accent); }
.section { margin-bottom: 28px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.section-head h2 { font-size: 21px; font-weight: 800; }
.grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.pcard { display: flex; gap: 14px; align-items: center; background: var(--s-card); border-radius: var(--s-radius); padding: 12px; transition: transform .15s var(--s-ease), box-shadow .15s var(--s-ease); }
.pcard:hover { box-shadow: var(--s-float); }
.pcard-img { width: 92px; height: 92px; border-radius: 16px; object-fit: cover; flex: none; background: #fff; }
.pcard-body { min-width: 0; display: grid; gap: 4px; justify-items: start; }
.pcard-title { font-size: 15px; line-height: 1.35; color: var(--s-ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard-price { display: flex; align-items: baseline; gap: 8px; }
.pcard-price strong { font-size: 19px; font-weight: 800; color: var(--s-ink); }
.pcard-price s { font-size: 13px; color: var(--s-gray-400); }
.pcard .badge { height: 26px; font-size: 13px; padding: 0 10px; }
.empty { background: var(--s-card); border-radius: var(--s-radius); padding: 20px; color: var(--s-soft); }

.app-banner { display: grid; gap: 14px; justify-items: start; margin-bottom: 28px; }
.app-banner h2 { font-size: 20px; font-weight: 800; margin-bottom: 4px; }

/* ---------- 공유 카드 페이지 ---------- */
.proof { display: grid; gap: 14px; padding: 12px 0; max-width: 760px; margin: 0 auto; }
.proof-img { width: 100%; height: auto; border-radius: var(--s-radius); background: #fff; }
.proof-now { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }

.empty-page { text-align: center; display: grid; gap: 10px; justify-items: center; margin: 40px auto; max-width: 420px; }

/* ---------- 꼬리 ---------- */
.footer { padding-top: 24px; padding-bottom: 40px; display: grid; gap: 6px; font-size: 12px; color: var(--s-soft); }
.footer-copy { margin-top: 4px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 12px 16px; border-radius: var(--s-radius-sm);
  background: var(--s-gray-900); color: #fff; font-size: 14px; box-shadow: var(--s-float);
  transition: opacity .2s var(--s-ease), transform .2s var(--s-ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 넓은 화면 ---------- */
@media (min-width: 420px) {
  .app-actions { grid-template-columns: 1fr 1fr; }
  .app-actions .btn { padding: 0 12px; font-size: 15px; }
}
@media (min-width: 720px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero h1 { font-size: 38px; }
  .app-banner { grid-template-columns: auto 1fr auto; align-items: center; }
}
@media (min-width: 1024px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .product-layout { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 20px; align-items: start; }
  .price-big { font-size: 46px; }
}
