/* 商店首页：所有品类一页铺开（货架）+ 顶部跳转条 + 购买弹窗。
   放在 universe-skin.css 之后：切角、像素字、配色都跟 monk 宇宙走；白天黑夜都用 --mk-* 变量。 */

/* ---------- 首屏：左边文案，右边「大家都在买」 ---------- */
.hero--split { text-align: left; justify-items: stretch; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: center; gap: 32px; padding-top: 40px; }
.hero--split .hero-copy { display: grid; gap: 14px; justify-items: start; }
.hero--split .checks, .hero--split .stats { justify-content: flex-start; }
.hero--split .mk-lede { max-width: 32em; }
.hot { padding: 20px 20px 14px; display: grid; gap: 4px; }
.hot-k { margin: 0; font-size: 12px; }
.hot h2 { margin: 0 0 6px; font-size: 19px; font-weight: 800; }
.hot-list { list-style: none; margin: 0; padding: 0; display: grid; }
.hot-list li { display: grid; grid-template-columns: 18px auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--mk-border); }
.hot-list li:first-child { border-top: 0; }
.hot-n { font-size: 15px; color: var(--mk-accent); text-align: center; }
.hot-t { display: grid; min-width: 0; }
.hot-t strong { font-size: 14.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hot-t small { color: var(--mk-muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.hot-list .mk-btn { height: 34px; padding: 0 14px; font-size: 13.5px; }
@media (max-width: 860px) {
  .hero--split { grid-template-columns: minmax(0, 1fr); gap: 22px; padding-top: 24px; }
}

/* ---------- 标题：「全部商品。一页看完。」 ---------- */
.shop { padding-top: 40px; }
.shop-head { grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px 24px; margin-bottom: 14px; }
.shop-head > div { display: grid; gap: 8px; }
.shop-head h2 span { color: var(--mk-muted); font-weight: 700; }
.shop-head > p { text-align: right; font-size: 14px; }
@media (max-width: 760px) { .shop-head { grid-template-columns: minmax(0, 1fr); } .shop-head > p { text-align: left; } }

/* ---------- 吸顶的跳转条：品类 + 搜索 + 只看有货 ---------- */
.shelfbar { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 72px); z-index: 30; display: flex; align-items: center; gap: 12px; margin: 0 calc(var(--mk-gutter-l, 20px) * -1) 18px; padding: 10px var(--mk-gutter-l, 20px); background: color-mix(in srgb, var(--mk-bg) 82%, transparent); backdrop-filter: blur(14px) saturate(150%); -webkit-backdrop-filter: blur(14px) saturate(150%); border-bottom: 1px solid var(--mk-border); }
@media (max-width: 760px) { .shelfbar { top: calc(env(safe-area-inset-top, 0px) + 62px); } }
.jump { flex: 1; min-width: 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.jump::-webkit-scrollbar { display: none; }
.jump-c { flex: none; scroll-snap-align: start; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px 0 5px; background: var(--mk-surface-2); color: var(--mk-text-2); font-size: 13.5px; font-weight: 700; text-decoration: none; white-space: nowrap; clip-path: var(--u-notch); transition: background .2s, color .2s; }
.jump-c:hover { background: var(--mk-surface-3); color: var(--mk-text); }
.jump-c .pic--sm { width: 30px; height: 30px; font-size: 13px; }
.jump-c i { font-style: normal; font-family: var(--u-px); font-size: 11px; color: var(--mk-muted); }
.jump-c.is-on { background: var(--mk-accent-soft); color: var(--mk-accent-ink); box-shadow: inset 0 0 0 1px var(--mk-accent-line); }
.jump-c.is-on i { color: var(--mk-accent-ink); }
.jump-c.is-empty { opacity: .45; }
.filters { flex: none; display: flex; align-items: center; gap: 8px; }
.search { position: relative; display: block; }
.search svg { position: absolute; left: 10px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--mk-muted); pointer-events: none; }
.search input { width: 200px; height: 40px; padding: 0 10px 0 32px; border: 1px solid var(--mk-border); background: var(--mk-surface); color: var(--mk-text); font: inherit; font-size: 14px; }
.search input:focus { outline: none; border-color: var(--mk-accent); box-shadow: 0 0 0 3px var(--mk-accent-soft); }
.instock { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; background: var(--mk-surface-2); font-size: 13.5px; font-weight: 700; color: var(--mk-text-2); cursor: pointer; white-space: nowrap; clip-path: var(--u-notch); }
.instock input { accent-color: var(--mk-accent); width: 15px; height: 15px; margin: 0; }
.instock:has(input:checked) { background: var(--mk-accent-soft); color: var(--mk-accent-ink); }
@media (max-width: 860px) {
  .shelfbar { flex-wrap: wrap; gap: 8px; }
  .jump { flex-basis: 100%; }
  .filters { flex: 1; }
  .search { flex: 1; }
  .search input { width: 100%; }
}

/* ---------- 货架：每个品类一块，按商品数占 1~4 列，挤满不留空 ---------- */
.shelves { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-flow: row dense; gap: 34px 16px; }
.shelf { min-width: 0; display: grid; grid-template-rows: auto 1fr; gap: 12px; scroll-margin-top: 150px; }
.shelf.span-2 { grid-column: span 2; }
.shelf.span-3 { grid-column: span 3; }
.shelf.span-4 { grid-column: 1 / -1; }
.shelf-head { display: grid; gap: 4px; align-content: start; }
.shelf-head h3 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.shelf-intro { margin: 0; color: var(--mk-muted); font-size: 13.5px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 3.1em; }
.shelf-cards { display: grid; gap: 16px; }
.shelf-cards.n-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.shelf-cards.n-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.shelf-cards.n-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) {
  .shelves { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shelf.span-3, .shelf.span-4 { grid-column: 1 / -1; }
  .shelf-cards.n-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .shelves { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .shelf.span-2, .shelf.span-3, .shelf.span-4 { grid-column: auto; }
  .shelf { scroll-margin-top: 170px; }
  .shelf-intro { min-height: 0; }
  .shelf-cards.n-2, .shelf-cards.n-3, .shelf-cards.n-4 { grid-template-columns: minmax(0, 1fr); gap: 12px; }
}

/* ---------- 商品卡 ---------- */
.pcard { display: flex; flex-direction: column; gap: 8px; padding: 18px; min-width: 0; height: 100%; }
.pcard:hover:not(.is-out) { box-shadow: inset 0 0 0 1px var(--mk-border-strong); }
.pcard-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 2px; }
.pcard h4 { margin: 0; font-size: 16.5px; font-weight: 800; line-height: 1.35; }
.pcard .sub { margin: 0; color: var(--mk-muted); font-size: 13.5px; line-height: 1.5; }
.pcard ul { margin: 2px 0 0; padding: 0; list-style: none; display: grid; gap: 5px; font-size: 13px; color: var(--mk-text-2); }
.pcard li { display: flex; gap: 6px; align-items: flex-start; line-height: 1.5; }
.pcard li svg { width: 14px; height: 14px; margin-top: 3px; color: var(--mk-ok); flex: none; }
.pcard-foot { margin-top: auto; padding-top: 12px; display: grid; gap: 6px; border-top: 1px dashed var(--mk-border); }
.pcard .price b { font-size: 24px; }
.pcard-meta { margin: 0; color: var(--mk-muted); font-size: 12.5px; }
.tier-chip { justify-self: start; }
.pcard-act { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.pcard-act .mk-btn { flex: 1; height: 40px; justify-content: center; }
.pcard-act .mk-btn:disabled { background: var(--mk-surface-3); color: var(--mk-muted); cursor: not-allowed; }
.pcard-act .mk-btn:disabled::before { display: none; }
.pcard-act .more { flex: none; color: var(--mk-accent-ink); font-size: 13.5px; font-weight: 700; text-decoration: none; }
.pcard-act .more:hover { text-decoration: underline; }
.pcard.is-out { opacity: .62; }
.pcard.is-out:hover { opacity: .8; }
.pcard.is-flash { animation: pflash 1.6s var(--mk-ease) 2; }
@keyframes pflash { 50% { box-shadow: inset 0 0 0 2px var(--mk-accent); } }
@media (max-width: 640px) {
  /* 手机：价格和按钮并排，卡片矮一点 */
  .pcard { padding: 16px; }
  .pcard ul li:nth-child(n + 3) { display: none; }
  .pcard-foot { grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px; }
  .pcard-foot .price, .pcard-meta, .tier-chip { grid-column: 1; }
  .pcard-act { grid-column: 2; grid-row: 1 / span 3; flex-direction: column; gap: 6px; margin: 0; }
  .pcard-act .mk-btn { flex: none; min-width: 96px; }
}

/* ---------- 购买弹窗：电脑居中，手机从底部升起 ---------- */
.buy-dlg { width: min(940px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 48px); padding: 0; border: 0; background: transparent; color: var(--mk-text); overflow: auto; overscroll-behavior: contain; }
.buy-dlg::backdrop { background: rgba(4, 5, 8, .62); backdrop-filter: blur(3px); }
.buy-dlg .buy { position: relative; margin: 0; background: var(--mk-surface); padding-top: 60px; }
.dlg-x { position: absolute; top: 12px; right: 12px; z-index: 2; }
.buy-dlg .buy-steps { position: absolute; top: 22px; left: 24px; margin: 0; }
@media (max-width: 860px) { .buy-dlg .buy-steps { left: 18px; } }
.picked-intro { margin: 12px 0 0; padding: 10px 12px; background: var(--mk-surface-2); color: var(--mk-text-2); font-size: 13.5px; line-height: 1.65; }
#pickedSpecs { margin-top: 10px; }
body.dlg-open { overflow: hidden; }
@media (max-width: 640px) {
  .buy-dlg { width: 100vw; max-height: 92dvh; margin: auto 0 0; }
  .buy-dlg .buy { clip-path: none; padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
}

/* 末尾的「没找到想要的？」：占几格由 store.js 的 fitAsk 按列数算 */
.shelf-ask { display: grid; align-content: center; gap: 8px; padding: 24px; min-height: 180px; background: linear-gradient(135deg, var(--mk-accent-soft), transparent 70%), var(--mk-surface); }
.shelf-ask .px { margin: 0; font-size: 12px; }
.shelf-ask h3 { margin: 0; font-size: 20px; font-weight: 800; }
.shelf-ask > p:not(.px) { margin: 0; color: var(--mk-muted); font-size: 14px; max-width: 34em; }
.shelf-ask-act { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
@media (max-width: 640px) { .shelf-ask { grid-column: auto; min-height: 0; } }

/* 手机顶栏放不下：「使用帮助」收起来（页脚和每张商品卡都有入口） */
@media (max-width: 560px) { .mk-header .mk-actions a[href="/store/help"] { display: none; } }

/* ================= 细节动效（配合 /store/ui/monk-motion.*） ================= */

/* 首屏入场：文案逐行升起，右侧卡片晚一拍，榜单逐条进来 */
.mm .hero-copy > * { animation: mmRise .9s var(--mm-spring) both; }
.mm .hero-copy > :nth-child(2) { animation-delay: .06s; }
.mm .hero-copy > :nth-child(3) { animation-delay: .12s; }
.mm .hero-copy > :nth-child(4) { animation-delay: .18s; }
.mm .hero-copy > :nth-child(n + 5) { animation-delay: .24s; }
.mm .hot:not([hidden]) { animation: mmRise 1s var(--mm-spring) .2s both; }
.mm .hot-list li { animation: mmRise .7s var(--mm-spring) both; }
.mm .hot-list li:nth-child(1) { animation-delay: .34s; }
.mm .hot-list li:nth-child(2) { animation-delay: .42s; }
.mm .hot-list li:nth-child(3) { animation-delay: .5s; }
@keyframes mmRise { from { opacity: 0; transform: translateY(18px); } }
.hot-list li { transition: background .2s var(--mm-ease); }
.hot-list li:hover .hot-n { transform: translateY(-2px); color: var(--mk-accent-2); }
.hot-n { transition: transform .3s var(--mm-spring), color .2s; }

/* 跳转条：选中块滑过去（有动效层时，选中项自己不再画底色） */
.jump { position: relative; }
.jump-c { position: relative; z-index: 1; }
.jump .mm-glide { background: var(--mk-accent-soft); box-shadow: inset 0 0 0 1px var(--mk-accent-line); clip-path: var(--u-notch); }
.jump:has(.mm-glide.is-on) .jump-c.is-on { background: transparent; box-shadow: none; }
.jump-c .pic { transition: transform .5s var(--mm-spring); }
.jump-c:hover .pic, .jump-c.is-on .pic { transform: rotate(-6deg) scale(1.08); }
.search svg { transition: color .2s var(--mm-ease), transform .3s var(--mm-spring); }
.search:focus-within svg { color: var(--mk-accent); transform: translateY(-50%) scale(1.12); }

/* 商品卡：像素层在最底下；悬停抬起、描边变火焰色、图标歪一下；按下沉一点 */
.pcard { position: relative; }
.pcard > :not(.mm-px) { position: relative; z-index: 1; }
.mm .pcard { transition: box-shadow .25s var(--mm-ease), transform .4s var(--mm-spring); }
.mm .pcard:hover:not(.is-out) { transform: translateY(-3px); box-shadow: inset 0 0 0 1px var(--mk-accent-line); }
.mm .pcard:active:not(.is-out) { transform: translateY(-1px) scale(.995); }
.pcard .pic { transition: transform .6s var(--mm-spring), filter .3s; }
.pcard:hover:not(.is-out) .pcard-top .pic { transform: translateY(-2px) rotate(-5deg) scale(1.07); }
.pcard.is-out .pic { filter: grayscale(.85); }
.pcard li svg { transition: transform .35s var(--mm-spring); }
.pcard:hover li svg { transform: scale(1.18); }
.pcard:hover li:nth-child(2) svg { transition-delay: .04s; }
.pcard:hover li:nth-child(3) svg { transition-delay: .08s; }
.pcard-act .more { transition: transform .25s var(--mm-spring); display: inline-block; }
.pcard-act .more:hover { transform: translateX(3px); }

/* 库存紧张：前面一颗一闪一闪的像素点（只标异常，「有货」不加） */
.mk-chip--warn::before { content: ""; width: 6px; height: 6px; margin-right: 6px; background: currentColor; display: inline-block; vertical-align: 1px; }
.mm .mk-chip--warn::before { animation: u-blink 1.6s steps(2) infinite; }

/* 购买弹窗：弹性入场 + 遮罩淡入；关闭时先退场；手机是底部抽屉，可以按住把手往下拉 */
.buy-dlg { translate: 0 var(--drag, 0px); }
.mm .buy-dlg[open] { animation: mmDlgIn .44s var(--mm-spring); }
.mm .buy-dlg[open]::backdrop { animation: mmFade .24s var(--mm-out); }
.mm .buy-dlg.is-closing { animation: mmDlgOut .2s var(--mm-ease) forwards; }
.mm .buy-dlg.is-closing::backdrop { animation: mmFade .2s var(--mm-ease) reverse forwards; }
.buy-dlg:not(.is-drag) { transition: translate .35s var(--mm-spring); }
@keyframes mmDlgIn { from { opacity: 0; transform: translateY(18px) scale(.965); } }
@keyframes mmDlgOut { to { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes mmFade { from { opacity: 0; } }
.sheet-grab { display: none; }
@media (max-width: 640px) {
  .mm .buy-dlg[open] { animation: mmSheetIn .42s var(--mm-ease); }
  .mm .buy-dlg.is-closing { animation: mmSheetOut .22s var(--mm-ease) forwards; }
  .sheet-grab { display: block; position: absolute; left: 0; right: 0; top: 0; height: 30px; z-index: 1; touch-action: none; cursor: grab; }
  .sheet-grab::after { content: ""; position: absolute; left: 50%; top: 9px; width: 36px; height: 5px; margin-left: -18px; background: var(--mk-border-strong); }
}
@keyframes mmSheetIn { from { transform: translateY(100%); } }
@keyframes mmSheetOut { to { transform: translateY(100%); } }
.picked .pic { transition: transform .6s var(--mm-spring); }
.mm .buy-dlg[open] .picked .pic { animation: mmPop .6s var(--mm-spring) .12s both; }
@keyframes mmPop { from { transform: scale(.6) rotate(-12deg); opacity: 0; } }

/* 付款按钮：点了以后图标换成转圈，按钮宽度不跳 */
.go.is-busy > svg { display: none; }
.go.is-busy::after { content: ""; order: -1; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: mmSpin .7s linear infinite; }
@keyframes mmSpin { to { transform: rotate(360deg); } }

/* 多买优惠的档位：点亮时弹一下 */
.tier { transition: background .2s var(--mm-ease), box-shadow .2s, transform .3s var(--mm-spring); }
.tier.is-on { transform: translateY(-1px); }

@media (prefers-reduced-motion: reduce) {
  .pcard.is-flash { animation: none; }
  .buy-dlg { transition: none !important; }
  .jump-c .pic, .pcard .pic, .pcard li svg { transition: none; transform: none !important; }
}
