* { box-sizing: border-box; }
:root {
  --bg: #fafafa; --fg: #111; --muted: #888; --line: #e6e6e6;
  --sale: #e5322d; --card: #fff;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f0f0f; --fg: #eee; --muted: #888; --line: #2a2a2a; --card: #181818; --sale: #ff5a52; }
}
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", sans-serif;
  -webkit-font-smoothing: antialiased;
}
.muted { color: var(--muted); font-size: 12px; }

.top {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  padding: 12px 14px 8px; border-bottom: 1px solid var(--line);
  padding-top: max(12px, env(safe-area-inset-top));
}
.brand { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.brand h1 { margin: 0; font-size: 20px; letter-spacing: -0.5px; }
#q {
  width: 100%; padding: 10px 12px; font-size: 15px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--fg);
}
.tabs { display: flex; gap: 16px; margin: 10px 0 6px; }
.tabs button {
  background: none; border: 0; padding: 4px 0; font-size: 15px; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent;
}
.tabs button.on { color: var(--fg); font-weight: 700; border-color: var(--fg); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button {
  flex: none; padding: 6px 12px; border-radius: 999px; font-size: 13px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--fg);
}
.chips button.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.row { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0; align-items: center; scrollbar-width: none; }
.row select {
  flex: none; padding: 6px 8px; font-size: 13px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--fg);
}
.chk { flex: none; font-size: 13px; white-space: nowrap; }
#count { margin-top: 4px; }

.grid {
  display: grid; gap: 14px 8px; padding: 12px;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(5, 1fr); max-width: 1400px; margin: 0 auto; } }

.card { position: relative; }
.card a { color: inherit; text-decoration: none; display: block; }
.thumb {
  aspect-ratio: 5 / 6; width: 100%; object-fit: cover; border-radius: 6px;
  background: var(--line); display: block;
}
.acts { position: absolute; top: 6px; right: 6px; display: flex; flex-direction: column; gap: 6px; }
.acts button {
  width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.85); font-size: 15px; line-height: 32px; padding: 0; color: #111;
}
.acts button.liked { color: var(--sale); }
.shopTag {
  position: absolute; left: 6px; top: 6px; font-size: 10px; padding: 2px 6px;
  background: rgba(0,0,0,.6); color: #fff; border-radius: 4px;
}
.info { padding: 6px 2px 0; }
.b { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.n {
  font-size: 12px; color: var(--muted); margin: 2px 0 4px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.p { font-size: 14px; font-weight: 700; }
.p .d { color: var(--sale); margin-right: 4px; }
.o { font-size: 11px; color: var(--muted); text-decoration: line-through; }
.r { font-size: 11px; color: var(--muted); margin-top: 2px; }
.more { text-align: center; padding: 20px; color: var(--muted); font-size: 13px; }
.empty { grid-column: 1 / -1; text-align: center; padding: 60px 0; color: var(--muted); }
