:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #16181d;
  --ink-2: #4b5260;
  --ink-3: #8a91a0;
  --line: #e6e8ec;
  --brand: #1f6feb;
  --brand-ink: #ffffff;
  --brand-soft: #e8f0fe;
  --accent: #0e9f6e;
  --warn: #b7791f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
button, input, select { font: inherit; color: inherit; }

/* 상단 */
.top { position: sticky; top: 0; z-index: 10; background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.top-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: var(--brand-ink); font-weight: 800; font-size: 15px; }
.brand-text { font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand-text b { color: var(--brand); }
.updated { color: var(--ink-3); font-size: 12px; }

.hero { padding: 28px 0 12px; }
.hero h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
.hero p { margin: 4px 0 0; color: var(--ink-2); }

/* 거르기 */
.filters { display: grid; gap: 10px; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; }
.search input { width: 100%; height: 44px; padding: 0 12px 0 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); outline: none; }
.search input:focus { border-color: var(--brand); background: #fff; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 34px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.row select { width: 100%; height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 14px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); }

.count { margin: 18px 2px 10px; color: var(--ink-2); font-size: 14px; }
.count b { color: var(--ink); }

/* 카드 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.card { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; text-align: left; padding: 0; box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease; }
.card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(16, 24, 40, .06), 0 10px 28px rgba(16, 24, 40, .1); }
.card:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.thumb { position: relative; aspect-ratio: 4 / 3; background: #eef0f3; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .n { position: absolute; right: 8px; bottom: 8px; padding: 2px 8px; border-radius: 999px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; font-weight: 600; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; }
.thumb .badge { position: absolute; left: 8px; top: 8px; }
.badge.real { background: var(--accent); color: #fff; }
.badge.ref { background: #fff; color: var(--ink-2); border: 1px solid var(--line); }
.badge.none { background: #fff; color: var(--ink-3); border: 1px solid var(--line); }
.info { padding: 12px 14px 14px; display: grid; gap: 4px; }
.price { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.price .deal { margin-right: 6px; color: var(--brand); }
.meta { color: var(--ink-2); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { color: var(--ink-3); font-size: 13px; }

.empty { padding: 48px 0; text-align: center; color: var(--ink-3); }
.foot { padding: 32px 16px 48px; color: var(--ink-3); font-size: 12px; }
.foot p { margin: 2px 0; }

/* 상세 */
dialog { width: min(760px, 100vw); max-height: 100dvh; margin: auto; padding: 0; border: 0; border-radius: 18px; background: var(--card); color: var(--ink); overflow: auto; }
dialog::backdrop { background: rgba(10, 12, 16, .6); }
.d-box { position: relative; }
.d-close { position: absolute; right: 10px; top: 10px; z-index: 3; width: 38px; height: 38px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; font-size: 24px; line-height: 1; cursor: pointer; }
.gallery { position: relative; background: #0f1115; }
.g-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; aspect-ratio: 4 / 3; }
.g-track::-webkit-scrollbar { display: none; }
.g-track img { flex: 0 0 100%; width: 100%; height: 100%; object-fit: contain; scroll-snap-align: center; }
.g-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .85); font-size: 26px; line-height: 1; cursor: pointer; }
.g-nav.prev { left: 10px; }
.g-nav.next { right: 10px; }
.g-count { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); padding: 2px 10px; border-radius: 999px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; }
.d-body { padding: 18px 20px 22px; }
.d-body h2 { margin: 8px 0 2px; font-size: 22px; letter-spacing: -.02em; }
.d-addr { margin: 0; color: var(--ink-2); }
.d-info { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 16px 0; padding: 14px 16px; border-radius: 12px; background: var(--bg); }
.d-info dt { color: var(--ink-3); }
.d-info dd { margin: 0; font-weight: 600; }
.d-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 16px; border-radius: 10px; background: var(--brand); color: var(--brand-ink); font-weight: 700; text-decoration: none; }
.btn.ghost { background: var(--brand-soft); color: var(--brand); }
.d-contact { margin-top: 12px; }

@media (max-width: 640px) {
  .hero h1 { font-size: 22px; }
  .row { grid-template-columns: 1fr 1fr; }
  .row select#sort { grid-column: 1 / -1; }
  .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .info { padding: 10px 11px 12px; }
  .price { font-size: 16px; }
  .meta { font-size: 13px; }
  dialog { border-radius: 0; height: 100dvh; }
  .g-nav { display: none; }
}
@media (max-width: 360px) {
  .grid { grid-template-columns: 1fr; }
}
