:root {
  --bg: #FAF7F2;
  --surface: #FFFFFF;
  --ink: #1C1A17;
  --ink-2: #4A453F;
  --muted: #8A837A;
  --line: #E8E1D6;
  --gold: #A87B2A;
  --gold-soft: #F3EBDC;
  --danger: #B3402F;
  --ok: #2F7D4F;
  --radius: 14px;
  --display: "Fraunces", Georgia, serif;
  --sans: "Inter", "Noto Sans KR", system-ui, -apple-system, sans-serif;
  --maxw: 1180px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
:lang(ko) body, body.ko { word-break: keep-all; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }
input, select, textarea { font: inherit; color: inherit; }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(250,247,242,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: var(--maxw); margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { display: flex; align-items: center; gap: 9px; font-family: var(--display); font-weight: 600; font-size: 20px; letter-spacing: -.01em; color: var(--ink); }
.logo svg { color: var(--gold); }
.top-actions { display: flex; align-items: center; gap: 4px; }
.icon-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 0; background: none; border-radius: 50%; }
.icon-btn:hover { background: var(--gold-soft); }
.lang-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; letter-spacing: .04em; }
.badge[hidden] { display: none; }
.badge { position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.searchbar { max-width: var(--maxw); margin: 0 auto; padding: 0 16px 10px; }
.searchbar input { width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); outline: none; }
.searchbar input:focus { border-color: var(--gold); }

main { max-width: var(--maxw); margin: 0 auto; padding: 0 16px 48px; min-height: 60vh; outline: none; }

/* ---------- Hero ---------- */
.hero { padding: 36px 0 22px; }
.hero h1 { font-family: var(--display); font-weight: 400; font-size: clamp(30px, 7vw, 52px); line-height: 1.08; letter-spacing: -.02em; margin: 0 0 10px; max-width: 16ch; }
.hero p { color: var(--ink-2); margin: 0; max-width: 46ch; }
.notice { margin-top: 18px; display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; background: var(--gold-soft); color: #6E5320; font-size: 13px; font-weight: 500; }
.notice::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }

/* ---------- Chips / filters ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface); padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 4px 0 14px; }
.filters select { padding: 8px 30px 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238A837A' fill='none' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 11px center; appearance: none; font-size: 13px; max-width: 48%; }
.count { color: var(--muted); font-size: 13px; margin-left: auto; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 0 12px; }
.section-head h2 { font-family: var(--display); font-weight: 400; font-size: 24px; margin: 0; letter-spacing: -.01em; }
.section-head a { font-size: 13px; color: var(--gold); font-weight: 600; }

/* ---------- Product grid ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 26px 18px; } }
@media (min-width: 1020px) { .grid { grid-template-columns: repeat(4, minmax(0,1fr)); } }
.card { display: block; }
.thumb { position: relative; aspect-ratio: 4 / 5; border-radius: var(--radius); overflow: hidden; background: #EFE9DF; }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover .thumb img { transform: scale(1.03); }
.tag { position: absolute; top: 8px; left: 8px; padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; background: rgba(255,255,255,.92); }
.tag.sold { background: var(--ink); color: #fff; }
.tag.sale { color: var(--danger); }
.card-body { padding: 9px 2px 0; }
.card-brand { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.card-name { font-size: 14px; margin: 2px 0 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.price { font-weight: 600; font-variant-numeric: tabular-nums; }
.price s { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 6px; }
.more { display: block; margin: 28px auto 0; padding: 12px 26px; border-radius: 999px; border: 1px solid var(--ink); background: none; font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 60px 0; }

/* ---------- Product detail ---------- */
.pd { display: grid; gap: 22px; padding-top: 14px; }
@media (min-width: 880px) { .pd { grid-template-columns: 1.1fr 1fr; gap: 44px; padding-top: 28px; } }
.back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); padding: 12px 0 0; }
.gallery { position: relative; }
.slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: var(--radius); scrollbar-width: none; background: #EFE9DF; }
.slides::-webkit-scrollbar { display: none; }
.slides img { flex: 0 0 100%; width: 100%; aspect-ratio: 4/5; object-fit: cover; scroll-snap-align: start; }
.dots { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--ink); }
.thumbs { display: none; gap: 8px; margin-top: 10px; overflow-x: auto; }
@media (min-width: 880px) { .thumbs { display: flex; } .dots { display: none; } }
.thumbs button { flex: 0 0 64px; height: 80px; border: 2px solid transparent; border-radius: 8px; overflow: hidden; padding: 0; background: none; }
.thumbs button.on { border-color: var(--ink); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.pd h1 { font-family: var(--display); font-weight: 400; font-size: 28px; line-height: 1.2; letter-spacing: -.01em; margin: 4px 0 10px; }
.pd .price { font-size: 22px; }
.opt-label { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 20px 0 8px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { min-width: 48px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 500; }
.opt.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.qty button { width: 40px; height: 40px; border: 0; background: none; font-size: 18px; }
.qty span { min-width: 30px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.actions { display: grid; gap: 10px; margin-top: 24px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 18px; border-radius: 12px; border: 1px solid var(--ink); background: var(--ink); color: #fff; font-weight: 600; font-size: 15px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: var(--surface); color: var(--ink); }
.btn.tg { background: #229ED9; border-color: #229ED9; }
.desc { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--ink-2); white-space: pre-wrap; font-size: 14px; }
.hint { color: var(--danger); font-size: 13px; margin-top: 8px; min-height: 1em; }

/* ---------- Cart ---------- */
.cart h1 { font-family: var(--display); font-weight: 400; font-size: 30px; margin: 24px 0 14px; }
.cart-grid { display: grid; gap: 24px; }
@media (min-width: 880px) { .cart-grid { grid-template-columns: 1.3fr 1fr; align-items: start; } }
.line { display: grid; grid-template-columns: 76px 1fr auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: start; }
.line img { width: 76px; height: 95px; object-fit: cover; border-radius: 10px; background: #EFE9DF; }
.line .nm { font-size: 14px; font-weight: 500; }
.line .meta { color: var(--muted); font-size: 12px; margin: 2px 0 8px; }
.line .rm { border: 0; background: none; color: var(--muted); font-size: 12px; text-decoration: underline; padding: 0; margin-left: 10px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.panel h2 { font-size: 15px; margin: 0 0 12px; }
.field { display: grid; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field input, .field textarea { width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); outline: none; }
.field input:focus, .field textarea:focus { border-color: var(--gold); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg button { padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); font-weight: 500; font-size: 14px; }
.seg button.on { border-color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--ink); }
.total { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 0; border-top: 1px solid var(--line); margin-top: 6px; font-size: 18px; font-weight: 600; }
.small { font-size: 12px; color: var(--muted); }
.done { text-align: center; padding: 36px 18px; }
.done .oid { font-family: var(--display); font-size: 28px; margin: 6px 0 12px; }
.paybox { text-align: left; margin: 18px auto 0; max-width: 360px; background: var(--gold-soft); border-radius: 12px; padding: 14px 16px; font-size: 14px; }

/* ---------- Footer / toast / loading ---------- */
.footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 28px 16px 40px; color: var(--muted); font-size: 13px; }
.footer-brand { font-family: var(--display); font-size: 20px; color: var(--ink); margin-bottom: 6px; }
.tg-link { display: inline-block; margin-top: 8px; color: #229ED9; font-weight: 600; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 30px); opacity: 0; background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 14px; transition: .25s; z-index: 50; pointer-events: none; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.loading { display: flex; justify-content: center; padding: 90px 0; }
.loading span { width: 28px; height: 28px; border: 2px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.noimg { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }
