:root {
  --black: #111;
  --gray-1: #f4f4f4;
  --gray-2: #e5e5e5;
  --gray-3: #999;
  --red: #ff3b30;
  --blue: #0b5fff;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Pretendard', -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  color: var(--black);
  background: #fff;
  -webkit-font-smoothing: antialiased;
}
body.lock { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* 헤더 */
.top-banner { background: var(--black); color: #fff; text-align: center; font-size: 12px; padding: 9px 0; letter-spacing: .02em; }
header.site { position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--gray-2); }
.head-row { display: flex; align-items: center; height: 60px; gap: 32px; }
.logo { font-size: 24px; font-weight: 900; letter-spacing: -.04em; }
.search { flex: 1; max-width: 420px; height: 38px; border-radius: 19px; background: var(--gray-1); padding: 0 16px; font-size: 14px; display: flex; align-items: center; color: var(--gray-3); }
.head-icons { margin-left: auto; display: flex; gap: 18px; font-size: 13px; color: #555; }
nav.cat { display: flex; gap: 28px; height: 46px; align-items: stretch; }
nav.cat a { display: flex; align-items: center; font-size: 15px; font-weight: 600; color: #777; border-bottom: 2px solid transparent; }
nav.cat a.active { color: var(--black); border-color: var(--black); font-weight: 800; }

/* 타이틀 */
.page-head { padding: 32px 0 12px; display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.page-head h1 { font-size: 26px; font-weight: 800; letter-spacing: -.03em; }
.page-head .count { font-size: 13px; color: var(--gray-3); margin-top: 6px; }
.sort { display: flex; gap: 14px; font-size: 13px; color: var(--gray-3); }
.sort button { padding: 4px 0; }
.sort button.active { color: var(--black); font-weight: 700; }

.chips { display: flex; gap: 8px; padding: 8px 0 20px; overflow-x: auto; }
.chips span { flex: none; padding: 8px 14px; border: 1px solid var(--gray-2); border-radius: 18px; font-size: 13px; }
.chips span:first-child { background: var(--black); color: #fff; border-color: var(--black); }

/* 상품 그리드 */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px 16px; padding-bottom: 80px; }
.card { cursor: pointer; }
.thumb { position: relative; aspect-ratio: 3/4; display: grid; place-items: center; overflow: hidden; }
.thumb .emoji { font-size: 88px; transition: transform .25s; }
.card:hover .thumb .emoji { transform: scale(1.08); }
.rank { position: absolute; left: 0; top: 0; background: var(--black); color: #fff; font-size: 12px; font-weight: 800; width: 24px; height: 24px; display: grid; place-items: center; }
.heart { position: absolute; right: 8px; bottom: 8px; font-size: 20px; color: #444; width: 32px; height: 32px; }
.heart.on { color: var(--red); }
.info { padding: 10px 2px 0; }
.brand { font-size: 12px; font-weight: 800; }
.name { font-size: 13px; color: #444; margin: 4px 0 6px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.price { font-size: 15px; font-weight: 800; }
.off { color: var(--red); margin-right: 4px; }

/* 구매 시트 */
.dim { position: fixed; inset: 0; background: rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 40; }
.dim.open { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; z-index: 50; left: 50%; bottom: 0; width: 100%; max-width: 520px; background: #fff; border-radius: 16px 16px 0 0; transform: translate(-50%, 100%); transition: transform .28s ease; padding: 20px 20px 24px; }
.sheet.open { transform: translate(-50%, 0); }
.sheet-top { display: flex; gap: 14px; }
.sheet-thumb { width: 96px; aspect-ratio: 3/4; display: grid; place-items: center; font-size: 44px; flex: none; }
.sheet-meta .brand { font-size: 13px; }
.sheet-meta .name { font-size: 15px; color: var(--black); -webkit-line-clamp: 3; }
.sheet-meta .origin { font-size: 12px; color: var(--gray-3); text-decoration: line-through; }
.sheet-meta .price { font-size: 20px; }
.sheet-close { position: absolute; right: 14px; top: 10px; font-size: 26px; color: #777; }
.sheet h4 { font-size: 13px; margin: 20px 0 10px; }
.sizes { display: flex; flex-wrap: wrap; gap: 8px; }
.sizes button { min-width: 64px; height: 42px; border: 1px solid var(--gray-2); font-size: 14px; }
.sizes button.active { border-color: var(--black); background: var(--black); color: #fff; }
.pay-btn { margin-top: 22px; width: 100%; height: 54px; background: var(--black); color: #fff; font-size: 16px; font-weight: 800; }
.pay-btn:disabled { background: #cfcfcf; cursor: not-allowed; }
.notice { margin-top: 10px; font-size: 11px; color: var(--gray-3); text-align: center; }

footer.site { background: var(--gray-1); padding: 32px 0 48px; font-size: 12px; color: #888; line-height: 1.8; }
footer.site b { color: #555; }

/* 결제 결과 */
.result { max-width: 480px; margin: 80px auto; padding: 0 20px; text-align: center; }
.result .mark { font-size: 56px; }
.result h1 { font-size: 24px; margin: 16px 0 8px; font-weight: 800; }
.result p.sub { color: #777; font-size: 14px; }
.result dl { margin: 28px 0; border-top: 2px solid var(--black); text-align: left; }
.result dl div { display: flex; justify-content: space-between; gap: 16px; padding: 14px 4px; border-bottom: 1px solid var(--gray-2); font-size: 14px; }
.result dt { color: #777; flex: none; }
.result dd { font-weight: 700; word-break: break-all; text-align: right; }
.btn { display: block; height: 52px; line-height: 52px; background: var(--black); color: #fff; font-weight: 800; }
.hint { margin-top: 18px; background: var(--gray-1); padding: 12px; font-size: 12px; color: #777; text-align: left; line-height: 1.6; }

/* 헤더 링크 */
.head-icons a { color: inherit; }
.head-icons a:hover { color: var(--black); text-decoration: underline; }

/* 구매 시트 리뷰 */
.sheet { max-height: 92vh; overflow-y: auto; }
.reviews { max-height: 180px; overflow-y: auto; border-top: 1px solid var(--gray-2); }
.empty { padding: 16px 0; font-size: 13px; color: var(--gray-3); }
.review { padding: 12px 0; border-bottom: 1px solid var(--gray-1); font-size: 13px; }
.rv-top { display: flex; justify-content: space-between; gap: 8px; }
.stars { color: #ffb400; letter-spacing: 1px; }
.rv-meta { color: var(--gray-3); font-size: 12px; }
.rv-body { margin: 6px 0; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.rv-like { font-size: 12px; color: #777; padding: 2px 0; }
.rv-like.on { color: var(--red); }

/* 로그인 */
.auth { max-width: 380px; margin: 64px auto; padding: 0 20px; }
.auth .logo { display: block; text-align: center; margin-bottom: 28px; }
.tabs { display: flex; border-bottom: 2px solid var(--gray-2); margin-bottom: 20px; }
.tabs button { flex: 1; padding: 12px 0; font-weight: 700; color: var(--gray-3); border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tabs button.active { color: var(--black); border-color: var(--black); }
[hidden] { display: none !important; }
.auth label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 14px; }
.auth input, #modalText { display: block; width: 100%; margin-top: 6px; padding: 12px; border: 1px solid var(--gray-2); font: inherit; font-weight: 400; }
.auth input:focus, #modalText:focus { outline: 2px solid var(--black); outline-offset: -1px; }
.auth .btn { width: 100%; font-size: 16px; }
.btn:disabled, .pay-btn:disabled { opacity: .6; cursor: not-allowed; }
.form-msg { min-height: 20px; margin: 4px 0 12px; font-size: 13px; color: var(--red); }
.btn-sub { margin-top: 8px; background: #fff; color: var(--black); border: 1px solid var(--black); height: 50px; line-height: 50px; }

/* 마이 페이지 */
.my h2 { font-size: 18px; margin: 28px 0 12px; }
.order { display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--gray-2); align-items: flex-start; }
.o-thumb { width: 64px; height: 80px; flex: none; display: grid; place-items: center; font-size: 30px; }
.o-main { flex: 1; min-width: 0; }
.o-status { font-size: 12px; font-weight: 800; }
.s-paid { color: #0a8f3c; } .s-canceled { color: var(--gray-3); } .s-failed { color: var(--red); } .s-pending { color: var(--blue); }
.o-name { font-size: 15px; font-weight: 700; margin: 4px 0; }
.o-meta { font-size: 12px; color: #777; line-height: 1.6; }
.o-id { word-break: break-all; color: var(--gray-3); }
.o-actions { display: flex; flex-direction: column; gap: 6px; }
.o-actions button { padding: 8px 12px; border: 1px solid var(--gray-2); font-size: 12px; white-space: nowrap; }
.o-actions button.primary { background: var(--black); color: #fff; border-color: var(--black); }
.liked { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; padding-bottom: 60px; }
.liked-item { display: flex; gap: 12px; align-items: center; font-size: 13px; line-height: 1.5; }
.sheet h3 { font-size: 18px; margin-bottom: 6px; }
.modal-sub { font-size: 13px; color: #777; margin-bottom: 14px; }
.stars-input { display: flex; gap: 4px; margin-bottom: 10px; }
.stars-input button { font-size: 28px; color: var(--gray-2); }
.stars-input button.on { color: #ffb400; }
#modalText { resize: vertical; margin-bottom: 4px; }

@media (max-width: 900px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 22px 10px; }
  .head-row { gap: 12px; }
  .search, .head-icons { display: none; }
  .wrap { padding: 0 12px; }
  .sheet { max-width: none; }
}
