:root {
  --bg: #FFFFFF;
  --soft: #F5F3EF;
  --chip: #F2F0EC;
  --line: #E7E4DF;
  --line2: #D8D4CD;
  --ink: #16161A;
  --ink2: #3D3B38;
  --sub: #5C5A57;
  --mute: #8A867F;
  --accent: #23408E;
  --accent-dark: #16295E;
  --accent-soft: #EEF1F8;
  --accent-soft2: #F6F8FC;
  --accent-line: #C9D2EA;
  --hot: #B03A17;
  --hot-soft: #FBF1EC;
  --hot-ink: #7A2A10;
  --star: #E2AE3B;
  --serif: 'Gowun Batang', serif;
  --sans: 'IBM Plex Sans KR', system-ui, sans-serif;
  --maxw: 560px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121214; --soft: #1D1D20; --chip: #232327; --line: #2C2C31; --line2: #3A3A40;
    --ink: #F2F0EC; --ink2: #D8D4CD; --sub: #A9A59E; --mute: #7E7A74;
    --accent: #8EA6E8; --accent-dark: #B9C8F2; --accent-soft: #1E2638; --accent-soft2: #1A2030; --accent-line: #34405E;
    --hot: #F08A62; --hot-soft: #2E1F18; --hot-ink: #F5B79C;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.5; -webkit-text-size-adjust: 100%; }
body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
body.no-tabs { padding-bottom: 0; }
a { color: var(--accent); }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--bg); }
img { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; }
.app { max-width: var(--maxw); margin: 0 auto; min-height: 100vh; }

/* 상단 */
.top { position: sticky; top: 0; z-index: 10; background: var(--bg); display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px 8px 20px; border-bottom: 1px solid transparent; }
.top.line { border-bottom-color: var(--line); }
.logo { font-family: var(--serif); font-size: 26px; font-weight: 700; letter-spacing: -0.5px; text-decoration: none; color: var(--ink); }
.top h1 { font-size: 18px; font-weight: 700; flex: 1; }
.icon-btn { width: 44px; height: 44px; border: 0; background: none; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; position: relative; color: var(--ink); text-decoration: none; }
.icon-btn:hover { background: var(--soft); }
.dot { position: absolute; top: 9px; right: 9px; min-width: 8px; height: 8px; border-radius: 4px; background: var(--hot); }
.back { margin-left: -12px; }

/* 칩 */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 20px 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; min-height: 36px; padding: 0 14px; border-radius: 18px; border: 0; background: var(--chip); color: var(--ink2); font-size: 13px; font-weight: 600; white-space: nowrap; }
.chip.on { background: var(--ink); color: var(--bg); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--chip); padding: 4px; border-radius: 12px; margin: 0 20px 12px; }
.seg button { min-height: 40px; border: 0; background: none; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--sub); }
.seg button.on { background: var(--bg); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* 목록 */
.section-h { display: flex; align-items: baseline; justify-content: space-between; padding: 12px 20px 10px; }
.section-h h2 { font-size: 17px; font-weight: 700; }
.section-h span { font-size: 12px; color: var(--sub); }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 12px; padding: 0 20px 28px; }
.card { display: flex; flex-direction: column; gap: 8px; min-width: 0; text-decoration: none; color: inherit; }
.thumb { position: relative; aspect-ratio: 4 / 5; background: var(--soft); border-radius: 8px; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.badge { position: absolute; left: 8px; top: 8px; background: var(--hot); color: #FFF; font-size: 11px; font-weight: 600; padding: 3px 7px; border-radius: 4px; }
.badge.blue { background: var(--accent); }
.card .meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.small { font-size: 12px; color: var(--sub); }
.ttl { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.price { font-size: 15px; font-weight: 700; }
.hot { color: var(--hot); font-weight: 600; }
.empty { padding: 48px 24px; text-align: center; color: var(--sub); display: flex; flex-direction: column; align-items: center; gap: 14px; }

/* 상세 */
.gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; background: var(--soft); scrollbar-width: none; }
.gallery::-webkit-scrollbar { display: none; }
.gallery img { flex: 0 0 100%; width: 100%; aspect-ratio: 1 / 1; object-fit: contain; scroll-snap-align: center; }
.gcount { text-align: center; font-size: 12px; color: var(--sub); padding: 6px; }
.pad { padding: 0 20px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 4px; background: var(--chip); color: var(--ink2); }
.tag.blue { background: var(--accent-soft); color: var(--accent); }
.tag.red { background: var(--hot); color: #FFF; }
.title-xl { font-family: var(--serif); font-size: 26px; font-weight: 700; line-height: 1.25; margin-top: 8px; }
.artist-row { margin: 14px 20px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: #FFF; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.verified { display: inline-flex; vertical-align: -3px; color: var(--accent); }
.pill { min-height: 36px; padding: 0 14px; border-radius: 18px; border: 0; font-size: 13px; font-weight: 700; background: var(--accent); color: #FFF; flex-shrink: 0; }
.pill.off { background: var(--chip); color: var(--ink2); }
.statbox { margin: 12px 20px; padding: 16px; background: var(--soft); border-radius: 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.statbox .k { font-size: 12px; color: var(--sub); }
.statbox .v { font-size: 22px; font-weight: 700; }
.statbox .v2 { font-size: 14px; font-weight: 600; }
.statbox .foot { grid-column: span 2; font-size: 12px; color: var(--sub); border-top: 1px solid var(--line2); padding-top: 10px; }
.note { margin: 0 20px 12px; padding: 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-dark); display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.note.warn { background: var(--hot-soft); color: var(--hot-ink); }
.note.plain { background: var(--soft); color: var(--ink2); }
.desc { white-space: pre-wrap; font-size: 14px; color: var(--ink2); }
.hist { list-style: none; margin: 0; padding: 0; }
.hist li { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.hist .me { color: var(--accent); font-weight: 700; }
.bar { position: sticky; bottom: 0; display: flex; gap: 10px; padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg); }
.like { width: 52px; height: 52px; border: 1px solid var(--line); border-radius: 12px; background: none; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* 버튼 · 입력 */
.btn { min-height: 52px; padding: 0 18px; border-radius: 12px; border: 0; background: var(--ink); color: var(--bg); font-size: 16px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.btn.block { width: 100%; }
.btn.grow { flex: 1; }
.btn.blue { background: var(--accent); color: #FFF; }
.btn.ghost { background: none; color: var(--ink); border: 1px solid var(--line2); }
.btn.sm { min-height: 44px; font-size: 14px; padding: 0 14px; border-radius: 10px; }
.btn:disabled { opacity: .45; cursor: default; }
.form { display: flex; flex-direction: column; gap: 16px; padding: 8px 20px 28px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.field .hint { font-weight: 400; color: var(--sub); font-size: 12px; }
.input, .select, .textarea { width: 100%; height: 48px; padding: 0 12px; border: 1px solid var(--line2); border-radius: 10px; font-size: 16px; font-weight: 400; }
.textarea { height: auto; padding: 12px; resize: vertical; min-height: 96px; }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; font-weight: 400; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); flex-shrink: 0; }
.optcard { border: 1px solid var(--line2); border-radius: 12px; padding: 14px 16px; background: var(--bg); text-align: left; display: flex; flex-direction: column; gap: 2px; width: 100%; }
.optcard.main { border: 2px solid var(--accent); background: var(--accent-soft2); }
.optcard strong { font-size: 15px; }
.optcard span { font-size: 13px; color: var(--sub); }
.photos { display: flex; gap: 8px; flex-wrap: wrap; }
.ph { width: 84px; height: 84px; border-radius: 10px; overflow: hidden; position: relative; background: var(--soft); }
.ph img { width: 100%; height: 100%; object-fit: cover; }
.ph button { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #FFF; font-size: 14px; line-height: 1; }
.ph.add { border: 1.5px dashed var(--line2); background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; color: var(--sub); cursor: pointer; }
.calc { background: var(--soft); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.calc div { display: flex; justify-content: space-between; }
.calc .tot { border-top: 1px solid var(--line2); padding-top: 8px; font-weight: 700; }
.calc .tot b { font-size: 20px; color: var(--accent); }

/* 거래 */
.steps { display: flex; flex-direction: column; padding: 4px 20px 8px; }
.step { display: flex; gap: 12px; }
.step .rail { display: flex; flex-direction: column; align-items: center; width: 20px; }
.step .d { width: 12px; height: 12px; border-radius: 50%; margin-top: 5px; background: var(--line2); flex-shrink: 0; }
.step.done .d { background: var(--accent); }
.step.cur .d { background: var(--bg); border: 3px solid var(--ink); }
.step .l { flex: 1; width: 2px; background: var(--line); }
.step.done .l { background: var(--accent); }
.step:last-child .l { display: none; }
.step .t { padding-bottom: 14px; display: flex; flex-direction: column; }
.step .t b { font-size: 14px; font-weight: 500; color: var(--mute); }
.step.done .t b, .step.cur .t b { color: var(--ink); }
.step.cur .t b { font-weight: 700; }
.box { margin: 0 20px 14px; border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.box.blue { border-color: var(--accent-line); background: var(--accent-soft2); }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.kv span:first-child { color: var(--sub); }
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 20px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--line); }
.list-item .thumb { width: 64px; height: 64px; aspect-ratio: auto; flex-shrink: 0; }
.list-item .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.stars { display: flex; gap: 4px; }
.stars button { width: 44px; height: 44px; border: 0; background: none; display: flex; align-items: center; justify-content: center; }
.taglist { display: flex; gap: 8px; flex-wrap: wrap; }
.taglist button { min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--line2); background: var(--bg); font-size: 13px; font-weight: 600; color: var(--ink2); }
.taglist button.on { background: var(--accent); border-color: var(--accent); color: #FFF; }

/* 하단 탭 */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--bg); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 6px 0 calc(8px + env(safe-area-inset-bottom)); }
.tabs.hide { display: none; }
.tabs a { position: relative; min-height: 50px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--mute); text-decoration: none; }
.tabs a.on { color: var(--ink); }
.tabs .dot { top: 6px; right: calc(50% - 18px); }
@media (min-width: 600px) { .tabs { left: 50%; right: auto; width: var(--maxw); transform: translateX(-50%); } }

/* 시트 · 토스트 */
.sheet-bg { position: fixed; inset: 0; z-index: 40; background: rgba(22,22,26,.45); display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.sheet { width: 100%; max-width: var(--maxw); background: var(--bg); border-radius: 20px 20px 0 0; padding: 20px 20px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; max-height: 90vh; overflow-y: auto; }
.grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line2); align-self: center; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 52px; height: 52px; border: 1px solid var(--line2); border-radius: 12px; background: var(--bg); font-size: 22px; }
.stepper .amt { flex: 1; text-align: center; font-size: 26px; font-weight: 700; }
.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-size: 14px; max-width: calc(100% - 32px); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 60; }
.toast.show { opacity: 1; }
.loading { padding: 60px 0; text-align: center; color: var(--sub); }
.banner { display: flex; gap: 12px; align-items: flex-start; margin: 4px 16px 12px; padding: 12px 14px; border-radius: 14px; background: var(--ink); color: var(--bg); text-decoration: none; }
.banner .ic { width: 36px; height: 36px; border-radius: 9px; background: var(--accent); color: #FFF; display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-weight: 700; flex-shrink: 0; }
.banner small { opacity: .75; font-size: 12px; }
.banner b { font-size: 14px; display: block; }
.banner span { font-size: 13px; opacity: .9; }
.test-tag { display: inline-block; font-size: 11px; font-weight: 700; color: var(--hot); border: 1px solid var(--hot); border-radius: 4px; padding: 1px 6px; margin-left: 6px; vertical-align: 2px; }
.prof { display: flex; align-items: center; gap: 14px; padding: 8px 20px 16px; }
.prof .avatar { width: 64px; height: 64px; font-size: 24px; }
.counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 0 20px 16px; }
.counts div { background: var(--soft); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; }
.counts b { font-size: 18px; }
.menu { display: flex; flex-direction: column; border-top: 1px solid var(--line); margin: 0 20px; }
.menu a, .menu button { min-height: 54px; display: flex; align-items: center; justify-content: space-between; border: 0; border-bottom: 1px solid var(--line); background: none; text-decoration: none; color: var(--ink); font-size: 15px; text-align: left; padding: 0; }
