/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50; background: var(--glass);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line); padding-top: var(--safe-t);
}
.topbar-in { max-width: 1120px; margin: 0 auto; height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; }
.brand { font-weight: 700; font-size: 17px; letter-spacing: -.02em; }
#shareBtn { color: var(--accent); }
.account-btn { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--accent); padding: 8px 4px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; }

/* ---------- page ---------- */
.page { max-width: 1120px; margin: 0 auto; padding: 22px 16px calc(40px + var(--safe-b)); }
.hero { padding: 8px 4px 18px; }
.hero h1 { animation: rise .7s var(--spring) both; font-size: 34px; letter-spacing: -.035em; line-height: 1.05; margin: 0; font-weight: 800; }
.hero p { margin: 8px 0 0; color: var(--ink-2); font-size: 16px; max-width: 46ch; }
@media (min-width: 720px) { .hero h1 { font-size: 46px; } }

/* category strip with sliding highlight */
.cats { position: relative; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 4px 4px 12px; margin: 0 -4px; }
.cats::-webkit-scrollbar { display: none; }
.cats .chip { flex: none; background: transparent; position: relative; z-index: 1; transition: color .25s; }
.cats .chip.on { background: transparent; color: var(--bg); }
.cats .thumb { position: absolute; top: 4px; height: 34px; left: 0; width: 0; border-radius: var(--r-pill); background: var(--ink); z-index: 0; transition: left .32s var(--spring), width .32s var(--spring); }
.cats .thumb.jump { transition: none; }

/* toolbar */
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.search { position: relative; flex: 1; }
.search .input { padding-left: 38px; border-radius: 12px; min-height: 42px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search .clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border-radius: 50%; background: var(--ink-3); color: var(--surface); font-size: 11px; display: grid; place-items: center; }
.sort .select { min-height: 42px; padding: 8px 34px 8px 12px; font-size: 14px; font-weight: 600; width: auto; }
.count { font-size: 13px; color: var(--ink-2); margin: 0 4px 10px; min-height: 18px; }

/* ---------- grid ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } }

.pcard {
  background: var(--surface); border-radius: var(--r-card); overflow: hidden; box-shadow: var(--shadow-1);
  text-align: left; display: flex; flex-direction: column; width: 100%;
  transition: transform .28s var(--spring), box-shadow .28s, opacity .3s;
  will-change: transform;
}
.pcard:active { transform: scale(.965); }
@media (hover: hover) { .pcard:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); } .pcard:hover:active { transform: scale(.97); } }
.pcard.enter { animation: card-in .55s var(--spring) both; animation-delay: calc(var(--i, 0) * 45ms); }
.pcard.leave { opacity: 0; transform: scale(.9); pointer-events: none; }
.pcard.flash .pimg::after { animation: flash 1.1s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes card-in { from { opacity: 0; transform: translateY(18px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes flash { from { opacity: .55; } to { opacity: 0; } }

.pimg { position: relative; aspect-ratio: 1; background: var(--surface-2); overflow: hidden; }
.pimg img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .45s ease; }
.pimg img.loaded { opacity: 1; }
.pimg::after { content: ""; position: absolute; inset: 0; background: var(--accent); opacity: 0; pointer-events: none; }
.pimg .noimg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); }
.pimg .tags { position: absolute; top: 10px; left: 10px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.pimg .tags .badge { position: static; }
.pimg .badge.stockb { top: auto; bottom: 10px; }
.badge.ink { background: var(--ink); color: var(--bg); }
.badge.purple { background: color-mix(in srgb, #AF52DE 18%, transparent); color: #8E44C9; }
.pimg .badge.tag.red { background: color-mix(in srgb, var(--red) 92%, transparent); color: #fff; }
.pimg .badge.tag.green { background: color-mix(in srgb, var(--green) 92%, transparent); color: #fff; }
.pimg .badge.tag.orange { background: color-mix(in srgb, var(--orange) 95%, transparent); color: #fff; }
.pimg .badge.tag.purple { background: #AF52DE; color: #fff; }
.pimg .badge.tag.ink { background: var(--ink); color: var(--bg); }
.pimg .badge { position: absolute; top: 10px; left: 10px; background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.pimg .badge.red { background: color-mix(in srgb, var(--red) 88%, transparent); color: #fff; }
.pimg .badge.blue { background: color-mix(in srgb, var(--accent) 92%, transparent); color: #fff; }
.pimg .badge::before { display: none; }
.pimg .fav { position: absolute; top: 10px; right: 10px; }
.pbody { padding: 11px 13px 13px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.pname { font-weight: 600; font-size: 15px; line-height: 1.25; letter-spacing: -.01em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pattrs .k { color: var(--ink-3); }
.pattrs { font-size: 12.5px; color: var(--ink-2); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pprice { margin-top: auto; padding-top: 6px; font-size: 15px; font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: 6px; }
.pprice.locked { color: var(--accent); font-weight: 600; font-size: 13.5px; }
.pprice.locked svg { flex: none; }
.pprice.none { color: var(--ink-3); font-weight: 500; font-size: 13px; }

/* skeleton cards */
.skel { border-radius: var(--r-card); overflow: hidden; background: var(--surface); box-shadow: var(--shadow-1); }
.skel .skeleton.img { aspect-ratio: 1; border-radius: 0; }
.skel .line { height: 12px; margin: 12px 13px 0; }
.skel .line.short { width: 45%; margin-bottom: 14px; }

.empty { text-align: center; padding: 60px 20px; color: var(--ink-2); }
.empty h3 { color: var(--ink); margin: 0 0 6px; font-size: 20px; letter-spacing: -.02em; }
.empty p { margin: 0; }

/* ---------- product sheet ---------- */
.gallery { touch-action: pan-x; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; margin: 4px -20px 0; padding: 0 20px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.gallery::-webkit-scrollbar { display: none; }
.gallery .slide { flex: 0 0 100%; scroll-snap-align: center; aspect-ratio: 1; border-radius: 20px; overflow: hidden; background: var(--surface-2); }
.gallery .slide img { width: 100%; height: 100%; object-fit: cover; }
.gallery.multi .slide { flex-basis: 88%; }
.dots { display: flex; gap: 6px; justify-content: center; margin: 12px 0 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); opacity: .5; transition: all .25s var(--spring); }
.dots i.on { opacity: 1; width: 18px; border-radius: 4px; background: var(--ink); }
.ptitle { font-size: 24px; font-weight: 800; letter-spacing: -.03em; line-height: 1.12; margin: 14px 0 4px; }
.pmeta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.pbig { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.pbig.locked { font-size: 15px; color: var(--accent); display: inline-flex; align-items: center; gap: 6px; }
.attrs { border-radius: 16px; background: var(--surface-2); overflow: hidden; margin-bottom: 14px; }
.attr { display: flex; justify-content: space-between; gap: 16px; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.attr:last-child { border-bottom: 0; }
.attr .k { color: var(--ink-2); flex: none; }
.attr .v { font-weight: 600; text-align: right; }
.pdesc { color: var(--ink-2); font-size: 15px; white-space: pre-wrap; margin: 0 0 16px; }
.sticky-cta { position: sticky; bottom: 0; padding: 12px 0 4px; background: linear-gradient(to top, var(--surface) 70%, transparent); }

/* ---------- auth ---------- */
.auth-switch { text-align: center; margin-top: 14px; font-size: 14px; }
.tier-note { font-size: 13px; color: var(--ink-2); }

/* live pulse in footer */
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); margin: 26px auto 0; justify-content: center; width: 100%; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 50%, transparent); animation: pulse 2.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 55%, transparent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
