@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css');

:root {
  --bg: #FBF7F2;
  --surface: #FFFFFF;
  --ink: #2B2420;
  --ink-2: #5C524B;
  --muted: #9A8F86;
  --line: #EDE4DA;
  --accent: #D9725A;
  --accent-ink: #FFFFFF;
  --accent-soft: #FBEAE3;
  --kakao: #FEE500;
  --kakao-ink: #191600;
  --danger: #C8442F;
  --radius: 14px;
  --gutter: 16px;
  --header-h: 56px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: 'Pretendard Variable', Pretendard, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  font-size: 15px; line-height: 1.55; letter-spacing: -0.01em; word-break: keep-all;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter); }

.pc-only { display: none !important; }
@media (min-width: 768px) {
  .pc-only { display: revert !important; }
  .mo-only { display: none !important; }
}

/* ---------- 헤더 ---------- */
.header {
  position: sticky; top: 0; z-index: 20; height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header .wrap { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { display: flex; align-items: baseline; gap: 8px; font-weight: 800; font-size: 21px; letter-spacing: -0.04em; }
.logo i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; transform: translateY(-2px); }
.logo small { font-size: 11px; font-weight: 600; letter-spacing: 0.12em; color: var(--muted); }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; }
.icon-btn:hover { background: var(--line); }
.back { margin-left: -10px; }

.btn-kakao {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 14px; border-radius: 999px; background: var(--kakao); color: var(--kakao-ink);
  font-weight: 700; font-size: 14px;
}
.btn-kakao svg { width: 18px; height: 18px; }
.btn-kakao.lg { height: 54px; border-radius: 12px; font-size: 16px; width: 100%; }

/* ---------- 메인 소개 ---------- */
.intro { padding: 22px 0 6px; }
.intro h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.035em; line-height: 1.35; }
.intro p { margin: 6px 0 0; color: var(--ink-2); font-size: 14px; }
@media (min-width: 768px) {
  .intro { padding: 48px 0 12px; }
  .intro h1 { font-size: 34px; }
  .intro p { font-size: 16px; }
}

/* ---------- 카테고리 탭 ---------- */
.tabs {
  display: flex; gap: 8px; overflow-x: auto; padding: 14px var(--gutter); margin: 0 calc(var(--gutter) * -1);
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; height: 36px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-size: 14px; font-weight: 600; color: var(--ink-2);
}
.tab[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- 상품 그리드 ---------- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px 12px; padding: 6px 0 48px; }
@media (min-width: 768px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 36px 20px; } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.card { display: block; }
.thumb {
  position: relative; aspect-ratio: 4 / 5; border-radius: var(--radius); overflow: hidden; background: var(--line);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
@media (hover: hover) { .card:hover .thumb img { transform: scale(1.04); } }
.badge {
  position: absolute; left: 8px; top: 8px; padding: 3px 8px; border-radius: 6px;
  background: rgba(43, 36, 32, .78); color: #fff; font-size: 11px; font-weight: 700;
}
.card .cat { margin-top: 10px; font-size: 12px; color: var(--muted); }
.card .name { margin-top: 2px; font-size: 14px; font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .price { margin-top: 4px; font-size: 15px; font-weight: 800; }
.card.soldout .thumb img { opacity: .55; }
.card.soldout .price { color: var(--muted); }
.empty { grid-column: 1 / -1; text-align: center; padding: 60px 0; color: var(--muted); }

/* 로딩 스켈레톤 */
.sk .thumb { animation: pulse 1.2s ease-in-out infinite; }
.sk .bar { height: 12px; margin-top: 10px; border-radius: 6px; background: var(--line); width: 70%; }
@keyframes pulse { 50% { opacity: .55; } }

/* ---------- 상세 ---------- */
.detail { padding-bottom: 110px; }
.gallery { position: relative; margin: 0 calc(var(--gutter) * -1); }
.slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.slides::-webkit-scrollbar { display: none; }
.slides img { flex: none; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; scroll-snap-align: start; background: var(--line); }
.dots { position: absolute; left: 0; right: 0; bottom: 12px; display: flex; justify-content: center; gap: 6px; }
.dots span { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.6); transition: width .2s; }
.dots span.on { width: 18px; border-radius: 3px; background: #fff; }
.counter { position: absolute; right: 12px; bottom: 10px; padding: 2px 8px; border-radius: 999px; background: rgba(0,0,0,.45); color: #fff; font-size: 12px; }
.thumbs { display: none; }

.info { padding-top: 20px; }
.info .cat { font-size: 13px; color: var(--accent); font-weight: 700; }
.info h1 { margin: 4px 0 0; font-size: 22px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.35; }
.info .price { margin-top: 8px; font-size: 24px; font-weight: 800; }
.soldout-tag { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 6px; background: var(--ink); color: #fff; font-size: 12px; vertical-align: middle; }
.opts { margin-top: 18px; padding: 14px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.opts dl { margin: 0; display: grid; gap: 8px; }
.opts .row { display: grid; grid-template-columns: 64px 1fr; gap: 8px; font-size: 14px; }
.opts dt { color: var(--muted); }
.opts dd { margin: 0; font-weight: 600; }
.notice { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); font-size: 13px; color: var(--ink-2); }
.notice b { color: var(--accent); }
.desc { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.desc h2 { margin: 0 0 12px; font-size: 16px; }
.desc .text { white-space: pre-wrap; color: var(--ink-2); font-size: 15px; line-height: 1.75; }
.desc .more-img img { width: 100%; margin-top: 12px; border-radius: 10px; }

.buybar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; gap: 8px;
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line);
}
.buybar .share { flex: none; width: 54px; height: 54px; border-radius: 12px; border: 1px solid var(--line); display: grid; place-items: center; }
.pc-actions { display: flex; gap: 8px; margin-top: 20px; }
.pc-actions .share { flex: none; width: 54px; height: 54px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; }

@media (min-width: 768px) {
  .detail { padding: 32px 0 80px; }
  .detail-top { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 48px; align-items: start; }
  .gallery { margin: 0; }
  .slides { border-radius: var(--radius); }
  .thumbs { display: flex; gap: 8px; margin-top: 10px; }
  .thumbs button { width: 64px; height: 64px; border-radius: 8px; overflow: hidden; opacity: .5; border: 2px solid transparent; padding: 0; }
  .thumbs button.on { opacity: 1; border-color: var(--ink); }
  .thumbs img { width: 100%; height: 100%; object-fit: cover; }
  .info { padding-top: 8px; position: sticky; top: calc(var(--header-h) + 24px); }
  .info h1 { font-size: 28px; }
  .info .price { font-size: 28px; }
  .buybar { display: none; }
  .pc-actions.pc-only { display: flex !important; }
  .desc { max-width: 760px; margin: 56px auto 0; }
}

/* ---------- 푸터 ---------- */
#footer { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--muted); font-size: 12px; }
.detail-page #footer { padding-bottom: 110px; }
@media (min-width: 768px) { .detail-page #footer { padding-bottom: 40px; } }
.f-name { color: var(--ink-2); font-size: 14px; }
.f-info { margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.f-info div { display: flex; gap: 6px; }
.f-info dt { font-weight: 600; }
.f-info dd { margin: 0; }
.tbd { opacity: .6; }
.f-note { margin: 12px 0 0; }
.f-copy { margin: 6px 0 0; }

/* ---------- 토스트 ---------- */
#toast {
  position: fixed; left: 50%; bottom: 90px; z-index: 100; transform: translate(-50%, 20px);
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px; background: rgba(43,36,32,.92); color: #fff;
  font-size: 14px; opacity: 0; pointer-events: none; transition: .25s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================
   관리자
   ========================================================== */
.admin-page { background: #F5F1EC; }
.admin-head .tag { font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 3px 8px; border-radius: 6px; }
.demo-note { margin: 14px 0 0; padding: 12px 14px; border-radius: 12px; background: #FFF6D6; color: #6A5300; font-size: 13px; }
.panel { background: var(--surface); border-radius: var(--radius); padding: 20px; margin-top: 16px; border: 1px solid var(--line); }
.login { max-width: 380px; margin: 40px auto; }
.login h1 { margin: 0 0 16px; font-size: 20px; }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.field small { font-weight: 400; color: var(--muted); }
.input, .textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 0 12px; height: 46px;
  font: inherit; font-size: 16px; color: var(--ink);
}
.textarea { height: auto; min-height: 140px; padding: 12px; line-height: 1.6; resize: vertical; }
.input:focus, .textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.checks { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 16px; }
.checks label { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.checks input { width: 18px; height: 18px; accent-color: var(--accent); }

.btn { height: 46px; padding: 0 18px; border-radius: 10px; font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:disabled { opacity: .5; cursor: wait; }
.btn-line { border: 1px solid var(--line); background: #fff; }
.btn-danger { color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { height: 34px; padding: 0 10px; font-size: 13px; border-radius: 8px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 20px; }
.toolbar h2 { margin: 0; font-size: 18px; }
.toolbar .count { color: var(--muted); font-weight: 500; font-size: 14px; margin-left: 4px; }

.alist { list-style: none; margin: 12px 0 40px; padding: 0; display: grid; gap: 8px; }
.aitem { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.aitem.hidden-item { opacity: .6; }
.aitem img { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; background: var(--line); }
.aitem .t { font-weight: 700; font-size: 14px; line-height: 1.35; }
.aitem .s { font-size: 13px; color: var(--muted); margin-top: 2px; }
.aitem .chips { display: flex; gap: 4px; margin-top: 4px; }
.chip { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 5px; background: var(--line); color: var(--ink-2); }
.chip.warn { background: #FDE2DC; color: var(--danger); }
.aitem .acts { display: flex; flex-direction: column; gap: 4px; }
.aitem .acts .row { display: flex; gap: 4px; }
.move { width: 34px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; }
.move:disabled { opacity: .3; }

/* 편집 시트 */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(30,24,20,.45); display: none; }
.sheet.open { display: block; }
.sheet-body {
  position: absolute; left: 0; right: 0; bottom: 0; top: 0; background: #F5F1EC; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.sheet-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 var(--gutter); background: #F5F1EC; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font-size: 17px; }
.sheet-form { padding: 16px var(--gutter) 120px; max-width: 680px; margin: 0 auto; }
.sheet-foot { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); }
.sheet-foot .btn-primary { flex: 1; }
@media (min-width: 768px) {
  .sheet-body { left: auto; width: 560px; box-shadow: -20px 0 60px rgba(0,0,0,.15); }
}

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.photo { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--line); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo .main-tag { position: absolute; left: 4px; top: 4px; font-size: 10px; font-weight: 800; background: var(--accent); color: #fff; padding: 1px 6px; border-radius: 4px; }
.photo .p-acts { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; padding: 4px; background: linear-gradient(transparent, rgba(0,0,0,.5)); }
.photo .p-acts button { width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,.92); font-size: 13px; display: grid; place-items: center; }
.add-photo { aspect-ratio: 1; border-radius: 10px; border: 1.5px dashed #CDBFB2; display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 12px; background: #fff; }
.add-photo b { display: block; font-size: 24px; font-weight: 400; line-height: 1; color: var(--ink-2); }
.uploading { opacity: .5; pointer-events: none; }
