:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --ink: #1f1d1a;
  --muted: #6b665e;
  --line: #e7e2da;
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --soft: #fdf1e8;
  --runbak: #c2410c;
  --writing: #4338ca;
  --living: #0f766e;
  --repeat: #a16207;
  --food: #be123c;
  --coffee: #78350f;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161513;
    --surface: #201f1c;
    --ink: #f1ede6;
    --muted: #a39d93;
    --line: #34322e;
    --accent: #f97316;
    --accent-ink: #1a1208;
    --soft: #2b211a;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Pretendard, -apple-system, "Malgun Gothic", sans-serif;
  line-height: 1.55;
}
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* 광고 표시: 쿠팡 검수 때 눈에 잘 띄어야 하므로 흐리게 하지 않는다 */
.disclosure {
  background: var(--soft);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
.disclosure strong, .site-footer strong { color: var(--accent); }
.ad-tag { color: var(--accent); font-size: .7em; vertical-align: middle; }
.d-ad {
  margin: 0;
  font-size: 13px;
  color: var(--ink);
  background: var(--soft);
  border-radius: 8px;
  padding: 8px 10px;
}

.site-header { padding: 36px 0 20px; }
.site-header h1 { margin: 0; font-size: 28px; letter-spacing: -0.02em; }
.tagline { margin: 6px 0 0; color: var(--muted); }

/* 상품 추가 */
.add-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 28px;
}
.add-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.add-head h2 { margin: 0; font-size: 18px; }
.badge {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent);
}
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.field em { font-style: normal; font-weight: 400; color: var(--muted); }
.field input, .field select {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
button, .btn {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:disabled { opacity: .55; cursor: wait; }
#f-submit { width: 100%; }

.either {
  border: 1.5px solid var(--accent);
  border-radius: 12px;
  padding: 6px 14px 2px;
  margin: 0 0 16px;
}
.either legend { padding: 0 6px; font-size: 14px; color: var(--muted); }
.either legend strong { color: var(--accent); }
.either legend em { font-style: normal; font-size: 13px; }
.or {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -2px 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.result { margin-top: 12px; }
.result .msg { margin: 8px 0 0; font-size: 14px; }
.result .msg.warn { color: var(--accent); }
.linklabel { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.linkbox { display: flex; gap: 8px; }
.linkbox input:disabled { color: var(--muted); }
.search-row { display: flex; gap: 8px; }
.search-row input { flex: 1; min-width: 0; }
.search-row button { flex: none; padding: 10px 16px; }
.search-result { margin: -4px 0 12px; }
.search-result .msg { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.cands.pick { max-height: 360px; overflow-y: auto; }
.cand.clickable { cursor: pointer; text-align: left; width: 100%; font: inherit; color: var(--ink); }
.cand.clickable:hover, .cand.clickable:focus-visible { border-color: var(--accent); outline: none; }
.cand .rocket { font-size: 11px; color: var(--writing); margin-left: 4px; }
.picked { outline: 2px solid var(--accent); }
.cands { display: grid; gap: 8px; margin-top: 10px; }
.cand {
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: var(--bg);
}
.cand img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; flex: none; }
.cand .ct { flex: 1; min-width: 0; font-size: 14px; }
.cand .ct b { display: block; }
.cand button { padding: 8px 10px; font-size: 13px; flex: none; }
.linkbox input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.ids { font-size: 12px; color: var(--muted); margin-top: 8px; word-break: break-all; }

/* 분류 칩 */
.list-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.refresh-msg { margin: -6px 0 16px; font-size: 14px; color: var(--muted); }
.price small { font-weight: 400; font-size: 12px; color: var(--muted); margin-left: 4px; }
.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 500;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* 상품 카드 */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.thumb {
  aspect-ratio: 1 / 1;
  background: var(--soft);
  display: grid;
  place-items: center;
  font-size: 44px;
  font-weight: 700;
  color: var(--cat, var(--accent));
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.card:not(.video) .thumb img { object-fit: contain; background: #fff; }
.thumb.wide { aspect-ratio: 1 / 1; position: relative; background: #000; }
.play {
  position: absolute;
  width: 56px; height: 40px;
  border-radius: 12px;
  background: rgba(220, 0, 0, .9);
  color: #fff;
  font-size: 18px;
  display: grid; place-items: center;
}
.card-body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.tag { font-size: 12px; font-weight: 600; color: var(--cat, var(--accent)); }
.card h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.price { font-weight: 700; font-size: 17px; }
.price.none { font-weight: 500; font-size: 14px; color: var(--muted); }
.review {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  border-left: 3px solid var(--line);
  padding-left: 8px;
}
.meta { font-size: 12px; color: var(--muted); }
.actions { display: flex; gap: 8px; margin-top: auto; padding-top: 6px; }
.actions .btn { flex: 1; text-align: center; padding: 9px 10px; font-size: 14px; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.off { background: var(--line); color: var(--muted); pointer-events: none; }
.sample-flag {
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 6px;
  margin-left: 6px;
}

/* 검색 상세 창 */
.detail {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  overflow-y: auto;
}
.detail::backdrop { background: rgba(0, 0, 0, .55); }
.d-img { background: #fff; display: grid; place-items: center; }
.d-img img { width: 100%; max-height: 52vh; object-fit: contain; }
.d-body { padding: 16px 18px 18px; display: grid; gap: 10px; position: relative; }
.d-count { font-size: 12px; color: var(--muted); }
.d-body h3 { margin: 0; font-size: 17px; line-height: 1.45; }
.d-price { font-size: 22px; font-weight: 700; }
.d-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.d-badges span {
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
  color: var(--muted);
}
.d-badges .rk { color: var(--writing); border-color: currentColor; }
.d-coupang, .d-pick { text-align: center; }
.d-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.d-nav .btn:disabled { opacity: .4; }
.d-close {
  position: fixed;
  top: 12px;
  right: 12px;
  width: 40px; height: 40px;
  border-radius: 999px;
  padding: 0;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  font-size: 18px;
}

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

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  padding: 24px 0 40px;
}

@media (max-width: 520px) {
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .site-header h1 { font-size: 24px; }
}

.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.rv-btn {
  margin-left: auto;
  background: none;
  border: 0;
  padding: 2px 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
}
