:root {
  --orange: #ff6f0f;
  --bg: #f2f3f6;
  --card: #ffffff;
  --text: #1a1c20;
  --sub: #6b6e76;
  --line: #eaebee;
  --dark: #212124;
  --radius: 28px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Pretendard", -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* ---------- 레이아웃 ---------- */
.layout {
  display: flex;
  gap: 32px;
  padding: 16px 20px;
  max-width: 1440px;
  margin: 0 auto;
  align-items: flex-start;
}
.main { flex: 1; min-width: 0; }

/* ---------- 헤더 ---------- */
.header { display: flex; align-items: center; gap: 24px; }
.logo { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.logo span { font-size: 28px; font-weight: 800; color: var(--orange); letter-spacing: -1px; }

.search {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--card);
  border-radius: 999px;
  height: 72px;
  padding: 0 26px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.search input {
  flex: 1; border: 0; outline: 0; font: inherit; font-size: 20px; background: transparent;
}
.search input::placeholder { color: #a0a3ab; }

.write-btn {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
  height: 56px; padding: 0 24px; border-radius: 999px;
  background: var(--orange); color: #fff; font-size: 18px; font-weight: 700;
}
.write-btn:hover { background: #e85f00; }

.empty {
  grid-column: 1 / -1; text-align: center; padding: 60px 0;
  color: var(--sub); font-size: 17px;
}

/* ---------- 탭 ---------- */
.tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 20px 0 0 134px;
  background: var(--card);
  border-radius: 999px;
  padding: 8px;
  max-width: calc(100% - 134px);
  overflow-x: auto;
  scrollbar-width: none;
}
.tab {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 20px; border-radius: 999px;
  font-size: 18px; color: #4d5159; white-space: nowrap;
}
.tab:hover { background: var(--bg); }
.tab.active { background: var(--dark); color: #fff; font-weight: 700; }
.tab.more { color: var(--sub); font-size: 16px; }

/* ---------- 타이틀 & 필터 ---------- */
.page-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 30px; font-weight: 800; letter-spacing: -0.5px;
  margin: 52px 0 24px 134px;
}
.filters { display: flex; align-items: center; gap: 12px; margin-left: 134px; flex-wrap: wrap; }
.chip {
  display: flex; align-items: center; gap: 8px;
  height: 46px; padding: 0 20px; border-radius: 999px;
  background: var(--card); font-size: 17px; font-weight: 700;
}
.chip:first-child { border-radius: 10px; }
.chip.dark { background: var(--dark); color: #fff; }
.divider { width: 2px; height: 20px; background: #d5d7dc; }

/* ---------- 상품 그리드 ---------- */
.grid-wrap {
  margin: 36px 0 0 134px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px 24px 40px;
}
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px 24px; }

.card { cursor: pointer; }
.card .thumb {
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.card:hover .thumb img, .card:hover .thumb .ph { transform: scale(1.03); }
.card.selected .thumb { outline: 3px solid var(--orange); outline-offset: 2px; }
.card .title {
  margin-top: 14px; font-size: 18px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card .price { margin-top: 4px; font-size: 20px; font-weight: 800; }
.card .sub { margin-top: 6px; font-size: 15px; color: var(--sub); }

/* 이미지/플레이스홀더 공통 */
.thumb img, .ph {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .25s;
}
.ph {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #f7f7f8, #e6e7ea);
  font-size: 72px;
}

/* ---------- 상세 패널 ---------- */
.detail {
  position: sticky;
  top: 16px;
  width: 460px;
  flex-shrink: 0;
  height: calc(100vh - 32px);
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  display: none;
}
.detail.open { display: block; animation: slideIn .25s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

.detail-inner { height: 100%; overflow-y: auto; scrollbar-width: thin; }

.carousel {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #eee;
}
.carousel-track { display: flex; height: 100%; transition: transform .3s ease; }
.carousel-track > * { flex: 0 0 100%; height: 100%; }
.carousel .ph { font-size: 140px; }

.icon-btn { position: absolute; color: #fff; filter: drop-shadow(0 1px 3px rgba(0,0,0,.4)); }
.icon-btn.close { top: 18px; left: 18px; color: var(--text); filter: drop-shadow(0 0 4px rgba(255,255,255,.8)); }
.icon-btn.nav { top: 50%; transform: translateY(-50%); padding: 8px; }
.icon-btn.prev { left: 8px; }
.icon-btn.next { right: 8px; }
.icon-btn[hidden] { display: none; }

.app-btn {
  position: absolute; top: 14px; right: 14px;
  background: var(--orange); color: #fff;
  font-weight: 700; font-size: 17px;
  padding: 12px 18px; border-radius: 10px;
}
.app-btn:hover { background: #e85f00; }

.dots {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 7px;
}
.dots span { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.5); cursor: pointer; }
.dots span.on { background: #fff; }

/* 판매자 */
.seller {
  display: flex; align-items: center; gap: 16px;
  padding: 22px 22px 24px;
  border-bottom: 1px solid var(--line);
}
.avatar { width: 62px; height: 62px; flex-shrink: 0; }
.avatar svg { width: 100%; height: 100%; }
.seller-info { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.seller-info strong { font-size: 19px; }
.seller-info span { font-size: 16px; color: #4d5159; }

.manner { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.manner-top { display: flex; align-items: center; gap: 6px; }
.temp { font-size: 21px; font-weight: 800; }
.face { font-size: 26px; line-height: 1; }
.manner-bar { width: 90px; height: 4px; border-radius: 2px; background: #e9ecef; overflow: hidden; }
.manner-bar span { display: block; height: 100%; border-radius: 2px; }
.manner-label { font-size: 14px; color: #868b94; text-decoration: underline; text-underline-offset: 3px; }

/* 상품 정보 */
.info { padding: 26px 22px 40px; }
.info h2 { font-size: 25px; font-weight: 800; line-height: 1.35; letter-spacing: -0.3px; }
.info .meta { margin-top: 14px; font-size: 15px; color: #868b94; }
.info .meta a { text-decoration: underline; text-underline-offset: 3px; }
.info .price { margin-top: 14px; font-size: 24px; font-weight: 800; }
.info .desc {
  margin-top: 26px; font-size: 18px; line-height: 1.7;
  white-space: pre-line; word-break: keep-all;
}
.info .stats { margin-top: 26px; font-size: 14px; color: #868b94; }

/* ---------- 반응형 ---------- */
@media (max-width: 1200px) {
  .tabs, .page-title, .filters, .grid-wrap { margin-left: 0; }
  .tabs { max-width: 100%; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .detail { width: 400px; }
}

@media (max-width: 860px) {
  .layout { padding: 12px 16px; }
  .header { gap: 12px; }
  .logo span { display: none; }
  .search { height: 52px; padding: 0 18px; }
  .search input { font-size: 16px; }
  .write-btn { height: 52px; width: 52px; padding: 0; justify-content: center; }
  .write-btn span { display: none; }
  .tab { font-size: 15px; padding: 10px 14px; }
  .page-title { font-size: 22px; margin-top: 28px; }
  .grid-wrap { padding: 16px; margin-top: 20px; }
  .grid { gap: 20px 12px; }
  .card .title { font-size: 15px; }
  .card .price { font-size: 16px; }
  .card .sub { font-size: 13px; }

  /* 모바일: 상세 화면을 전체 화면으로 */
  .detail {
    position: fixed; inset: 0; width: auto; height: auto;
    border-radius: 0; z-index: 100;
  }
  body.detail-open { overflow: hidden; }
}
