.shop-page { display: grid; gap: 1.25rem; }
.shop-icon { width: 18px; height: 18px; flex: 0 0 auto; vertical-align: middle; }
.shop-hero { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-bottom: 1.2rem; border-bottom: 1px solid var(--border-color); }
.shop-eyebrow { margin: 0; font-size: .68rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-foreground); }
.shop-hero h1 { margin: .25rem 0; font-size: 2rem; line-height: 1.2; }
.shop-balance-card { display: grid; gap: .2rem; min-width: 160px; padding: .65rem .9rem; border: 1px solid var(--border-color); border-radius: 8px; background: var(--card); color: var(--foreground); text-decoration: none; }
.shop-balance-card__label { display: flex; align-items: center; gap: .35rem; }
.shop-balance-card__label, .shop-balance-card__hint { font-size: .7rem; color: var(--muted-foreground); }
.shop-balance-card__hint { display: flex; justify-content: space-between; }
.shop-balance-card strong { font-size: 1.2rem; }
.shop-layout { display: grid; grid-template-columns: 174px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.shop-sidebar { position: sticky; top: 90px; }
.shop-sidebar h2 { margin: .25rem 0 .65rem; color: var(--muted-foreground); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; }
.shop-types { display: grid; gap: .3rem; }
.shop-type { display: flex; align-items: center; gap: .6rem; min-height: 42px; padding: .55rem .7rem; border: 1px solid transparent; border-radius: 6px; color: var(--muted-foreground); text-decoration: none; font-size: .8rem; }
.shop-type.is-active { background: var(--muted); border-color: var(--border-color); color: var(--foreground); font-weight: 600; }
.shop-type:hover { color: var(--foreground); background: var(--muted); }
.shop-catalog { display: grid; gap: 1rem; min-width: 0; }
.shop-search { display: flex; align-items: center; gap: .6rem; padding: .35rem .4rem .35rem .8rem; border: 1px solid var(--border-color); border-radius: 7px; background: var(--card); }
.shop-search > span { display: flex; color: var(--muted-foreground); }
.shop-search input[type="search"] { flex: 1; min-width: 0; width: 100%; padding: .45rem 0; border: 0; background: transparent; color: var(--foreground); font: inherit; font-size: .85rem; outline: none; box-shadow: none; }
.shop-search:focus-within { border-color: var(--foreground); }
.shop-filters { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; margin: 0; font-size: .76rem; }
.shop-filters__stock, .shop-filters__sort { display: inline-flex; align-items: center; gap: .45rem; }
.shop-filters__stock { cursor: pointer; }
.shop-filters__stock input { width: 15px; height: 15px; margin: 0; accent-color: var(--foreground); }
.shop-filters__sort > span { color: var(--muted-foreground); }
.shop-filters__sort select { width: auto; min-height: 34px; padding: .35rem 1.8rem .35rem .55rem; border: 1px solid var(--border-color); border-radius: 5px; background-color: var(--card); color: var(--foreground); font: inherit; box-shadow: none; }
.shop-page .shop-search input[type="search"]:is(:hover, :focus, :focus-visible) { background: transparent; border-color: transparent; outline: none; box-shadow: none; }
.shop-search__submit { flex: none; padding: .55rem .8rem; border: 1px solid var(--border-color); border-radius: 5px; background: var(--muted); color: var(--foreground); font: inherit; font-size: .75rem; cursor: pointer; }
.shop-balance-card { position: relative; }
.shop-coin-deduction { position: absolute; right: .5rem; top: 100%; z-index: 5; color: var(--moe-coin-color); font-size: 1.15rem; font-weight: 700; white-space: nowrap; pointer-events: none; animation: shop-coin-fade 1.5s ease-out both; }
@keyframes shop-coin-fade { 0% { opacity: 0; transform: translateY(6px); } 18% { opacity: .95; } 100% { opacity: 0; transform: translateY(-30px); } }
@media (prefers-reduced-motion: reduce) { .shop-coin-deduction { animation: none; } }
.shop-body .bf-toast { background: var(--card); color: var(--foreground); border: 1px solid var(--border-color); box-shadow: none; }
.shop-toolbar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.shop-toolbar h2 { display: flex; align-items: center; gap: .5rem; margin: 0; font-size: 1rem; }
.shop-toolbar > span { font-size: .73rem; color: var(--muted-foreground); white-space: nowrap; }
.shop-theme-picker { min-width: 0; border: 1px solid var(--border-color); border-radius: 8px; background: var(--card); }
.shop-theme-picker__summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 1rem; border-radius: 8px; cursor: pointer; list-style: none; }
.shop-theme-picker__summary::-webkit-details-marker { display: none; }
.shop-theme-picker__summary:hover { background: var(--muted); }
.shop-theme-picker__icon { display: none; }
.shop-theme-picker__selection { display: grid; gap: .2rem; min-width: 0; }
.shop-theme-picker__selection > span, .shop-theme-picker__toggle { color: var(--muted-foreground); font-size: .73rem; }
.shop-theme-picker__selection strong { font-size: .88rem; line-height: 1.45; overflow-wrap: anywhere; }
.shop-theme-picker__toggle { display: flex; align-items: center; gap: .6rem; flex: none; }
.shop-theme-picker[open] .shop-theme-picker__toggle .shop-icon { transform: rotate(180deg); }
.shop-theme-picker__body { padding: .85rem; border-top: 1px solid var(--border-color); }
.shop-theme-search { display: none; align-items: center; gap: .6rem; margin-bottom: .65rem; padding: 0 .75rem; border: 1px solid var(--border-color); border-radius: 6px; color: var(--muted-foreground); background: var(--background); }
.shop-page[data-theme-search-ready="1"] .shop-theme-search { display: flex; }
.shop-theme-search:focus-within { border-color: var(--foreground); outline: 1px solid var(--foreground); }
.shop-page .shop-theme-search input[type="search"] { width: 100%; min-width: 0; height: 42px; margin: 0; padding: .5rem 0; border: 0; border-radius: 0; background: transparent; color: var(--foreground); font: inherit; font-size: .82rem; outline: none; box-shadow: none; }
.shop-theme-options { display: grid; gap: .6rem; }
.shop-theme-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .35rem; max-height: 300px; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-width: thin; scrollbar-gutter: stable; padding: .2rem; }
.shop-theme-option { display: flex; align-items: center; gap: .5rem; min-width: 0; min-height: 44px; padding: .55rem .7rem; border: 1px solid transparent; border-radius: 6px; color: var(--foreground); text-decoration: none; font-size: .78rem; line-height: 1.5; }
.shop-theme-option > span:first-child { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.shop-theme-option__count { flex: none; min-width: 1.7rem; padding: .1rem .35rem; border-radius: 4px; background: var(--muted); color: var(--muted-foreground); font-size: .68rem; text-align: center; font-variant-numeric: tabular-nums; }
.shop-theme-option:hover { background: var(--muted); }
.shop-theme-option.is-active { border-color: var(--foreground); background: var(--muted); font-weight: 600; }
.shop-theme-option--all { justify-self: start; gap: 1.5rem; }
.shop-theme-option[hidden], .shop-theme-status[hidden] { display: none; }
.shop-theme-status { margin: .7rem .2rem 0; color: var(--muted-foreground); font-size: .78rem; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: .75rem; }
.shop-product-section { display: grid; gap: 1rem; min-width: 0; }
.shop-product-card { display: flex; flex-direction: column; min-width: 0; overflow: hidden; border: 1px solid var(--border-color); border-radius: 8px; background: var(--card); }
.shop-product-card { cursor: pointer; }
.shop-product-card:focus-within { border-color: var(--foreground); }
.shop-product-card__details { display: block; width: 100%; padding: 0; border: 0; border-radius: 0; background: transparent; color: inherit; font: inherit; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; box-shadow: none; }
.shop-product-card__details:focus-visible { outline: none; }
.shop-product-card:has(.shop-product-card__details:focus-visible) { outline: 2px solid var(--foreground); outline-offset: 2px; }
.shop-details { width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); margin: auto; padding: 1rem; overflow-y: auto; border: 1px solid var(--border-color); border-radius: 10px; background: var(--card); color: var(--foreground); box-shadow: none; }
.shop-details::backdrop { background: rgba(0, 0, 0, .75); }
html:has(.shop-details[open]) { overflow: hidden; }
.shop-details__header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.shop-details__close { display: grid; place-items: center; flex: none; width: 36px; height: 36px; padding: 0; border: 1px solid var(--border-color); border-radius: 5px; background: transparent; color: var(--foreground); cursor: pointer; box-shadow: none; }
.shop-details__close:focus-visible { outline: 2px solid var(--foreground); outline-offset: 2px; }
.shop-details__preview { display: grid; place-items: center; padding: 1rem; margin: .75rem 0; border: 1px solid var(--border-color); border-radius: 6px; background: var(--muted); }
.shop-details__theme { margin: 0 0 .35rem; font-size: .75rem; color: var(--muted-foreground); }
.shop-details h2 { margin: 0; font-size: 1.15rem; line-height: 1.4; overflow-wrap: anywhere; }
.shop-details__description { margin: .6rem 0 1rem; font-size: .85rem; line-height: 1.6; color: var(--muted-foreground); white-space: pre-wrap; overflow-wrap: anywhere; }
.shop-details__description:empty { display: none; }
.shop-details__stats { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem 1rem; margin-bottom: 1rem; padding-top: .85rem; border-top: 1px solid var(--border-color); }
.shop-product-card__preview { position: relative; display: grid; place-items: center; height: 152px; flex: 0 0 auto; border-bottom: 1px solid var(--border-color); background: var(--muted); }
.shop-product-card__preview-art { position: relative; display: grid; place-items: center; width: 128px; height: 128px; }
.shop-product-card__avatar-placeholder { position: absolute; display: grid; place-items: center; width: calc(100% / var(--avatar-frame-scale, 1.25)); height: calc(100% / var(--avatar-frame-scale, 1.25)); overflow: hidden; border-radius: 50%; background: var(--card); }
.shop-product-card__avatar-placeholder .shop-icon { width: 55%; height: 55%; color: var(--muted-foreground); }
.shop-preview-avatar { display: block; width: 100%; height: 100%; object-fit: cover; }
.shop-preview-frame { position: relative; z-index: 1; display: block; width: 128px; height: 128px; object-fit: contain; }
.shop-product-card__badge { position: absolute; z-index: 2; top: .5rem; left: .5rem; display: flex; align-items: center; gap: .2rem; padding: .2rem .35rem; border: 1px solid var(--border-color); border-radius: 4px; background: var(--card); font-size: .6rem; }
.shop-product-card__badge .shop-icon { width: 12px; height: 12px; }
.shop-product-card__ribbon { position: absolute; z-index: 3; top: 12px; right: -28px; width: 100px; padding: 3px 0; transform: rotate(45deg); background: #fbbf24; color: #241a05; box-shadow: 0 2px 5px #0002; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; letter-spacing: .04em; pointer-events: none; }
.shop-product-card__body { display: flex; flex-direction: column; flex: 1; gap: .65rem; padding: .75rem; }
.shop-product-card__theme { display: flex; align-items: center; gap: .3rem; margin: 0 0 .35rem; height: 1.2em; overflow: hidden; font-size: .65rem; color: var(--muted-foreground); white-space: nowrap; }
.shop-product-card__theme .shop-icon { width: 12px; height: 12px; }
.shop-product-card h3 { margin: 0; font-size: .9rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-product-card__description { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; height: 2.8em; margin: .35rem 0 0; overflow: hidden; overflow-wrap: anywhere; color: var(--muted-foreground); font-size: .73rem; line-height: 1.4; }
.shop-product-card__meta { display: flex; align-items: center; justify-content: space-between; gap: .3rem; margin-top: auto; }
.shop-product-card__price { display: flex; align-items: center; gap: .25rem; white-space: nowrap; }
.shop-product-card__price .shop-icon { width: 15px; height: 15px; }
.shop-product-card__price strong { font-size: 1rem; }
.shop-product-card__price > span { color: var(--muted-foreground); font-size: .65rem; }
.shop-stock { display: inline-flex; align-items: center; gap: .25rem; white-space: nowrap; font-size: .65rem; color: var(--muted-foreground); }
.shop-stock .shop-icon { width: 13px; height: 13px; }
.shop-stock.is-empty { color: var(--foreground); }
.shop-purchase-count { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted-foreground); font-size: .65rem; line-height: 1.2; }
.shop-purchase-count .shop-icon { width: 13px; height: 13px; }
.shop-buy-form { display: flex; margin: 0; }
.shop-action, .shop-owned-note { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; width: 100%; height: 36px; padding: 0 .5rem; border: 1px solid var(--foreground); border-radius: 5px; background: var(--foreground); color: var(--background); font: inherit; font-size: .76rem; font-weight: 600; line-height: 1; white-space: nowrap; box-shadow: none; }
.shop-action { cursor: pointer; }
.shop-action .shop-icon, .shop-owned-note .shop-icon { width: 16px; height: 16px; }
.shop-action:hover:not(:disabled) { background: #ddd; color: #111; border-color: #ddd; }
.shop-action:disabled, .shop-owned-note { background: transparent; border-color: var(--border-color); color: var(--muted-foreground); }
.shop-action:disabled { cursor: default; }
.shop-type:focus-visible, .shop-action:focus-visible { outline: 2px solid var(--foreground); outline-offset: 3px; }
.shop-theme-picker__summary:focus-visible, .shop-theme-option:focus-visible { outline: 2px solid var(--foreground); outline-offset: -2px; }
.shop-feedback { margin: 0; padding: .7rem .85rem; border: 1px solid var(--border-color); border-radius: 6px; background: var(--muted); font-size: .85rem; }
.shop-feedback[hidden] { display: none; }
.shop-body [data-public-confirm-meta] .chip { color: var(--moe-coin-color); font-size: .95rem; }
.shop-empty { padding: 3rem 1rem; text-align: center; border: 1px dashed var(--border-color); border-radius: 8px; }
.shop-empty h2 { font-size: 1rem; }
.shop-empty p { color: var(--muted-foreground); }
.shop-pagination { justify-content: center; margin-top: .5rem; }
.shop-pagination .button, .shop-pagination .chip { min-width: 34px; min-height: 34px; padding: .35rem .65rem; }
.shop-pagination .is-disabled { opacity: .4; cursor: default; pointer-events: none; }
/* Preserve the current catalog geometry while only the product results are loading. */
.shop-layout[data-catalog-results][aria-busy="true"] { min-height: 0; max-height: none; overflow: visible; }
.shop-layout[data-catalog-results][aria-busy="true"] > * { visibility: visible; }
.shop-layout[data-catalog-results][aria-busy="true"]::after { content: none; }
.shop-layout[aria-busy="true"] .shop-product-card__preview > *,
.shop-layout[aria-busy="true"] .shop-product-card__body *,
.shop-layout[aria-busy="true"] .shop-toolbar > span,
.shop-layout[aria-busy="true"] .shop-pagination { visibility: hidden; }
.shop-layout[aria-busy="true"] :where(.shop-product-card__theme, .shop-product-card h3, .shop-product-card__description, .shop-product-card__price, .shop-stock, .shop-purchase-count, .shop-buy-form, .shop-toolbar > span) { position: relative; }
.shop-layout[aria-busy="true"] :where(.shop-product-card__theme, .shop-product-card h3, .shop-product-card__description, .shop-product-card__price, .shop-stock, .shop-purchase-count, .shop-buy-form, .shop-toolbar > span)::after { content: ""; position: absolute; inset: 0; visibility: visible; border-radius: 4px; background: var(--muted); }
.shop-layout[aria-busy="true"] .shop-product-card__theme::after { right: 50%; }
.shop-layout[aria-busy="true"] .shop-product-card h3::after { right: 15%; }
.shop-layout[aria-busy="true"] .shop-product-card__description::after { right: 8%; }
.shop-layout[aria-busy="true"] .shop-purchase-count::after { right: 55%; }
.shop-layout[aria-busy="true"] .shop-product-card__preview::after { content: ""; position: absolute; width: 74%; max-width: 112px; aspect-ratio: 1; border-radius: 50%; background: var(--border-color); }
.shop-layout[aria-busy="true"] .shop-empty { position: relative; background: var(--card); border-style: solid; }
.shop-layout[aria-busy="true"] .shop-empty > * { visibility: hidden; }
.shop-layout[aria-busy="true"] .shop-empty::after { content: ""; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(220px, 70%); height: 16px; border-radius: 4px; background: var(--muted); }
.shop-page:has(.shop-layout[aria-busy="true"]) > .catalog-navigation-notice { position: fixed; bottom: 1rem; left: 50%; z-index: 50; transform: translateX(-50%); max-width: calc(100% - 2rem); padding: .6rem .9rem; border: 1px solid var(--border-color); border-radius: 6px; background: var(--card); color: var(--foreground); }
/* Reuse the site's confirmation dialog, scoped to this page's flat palette. */
.shop-body [data-public-confirm-dialog] { max-width: min(440px, calc(100vw - 24px)); }
.shop-body [data-public-confirm-dialog]::backdrop { background: rgba(0, 0, 0, .75); backdrop-filter: none; }
.shop-body [data-public-confirm-dialog] .modal-card { background: var(--card); border: 1px solid var(--border-color); box-shadow: none; border-radius: 10px; }
.shop-body [data-public-confirm-dialog] .modal-close::before { content: none; }
.shop-body [data-public-confirm-dialog] .button { box-shadow: none; }
.shop-body [data-public-confirm-dialog] .modal-title { font-size: 1rem; }
@media (max-width: 900px) {
  .shop-layout { grid-template-columns: 140px minmax(0, 1fr); gap: 1rem; }
  .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shop-type { padding-inline: .45rem; gap: .4rem; }
}
@media (max-width: 760px), (pointer: coarse) {
  .shop-theme-picker { border-color: #685a2b; }
  .shop-theme-picker__summary { background: #1a180f; gap: .65rem; }
  .shop-theme-picker__summary:hover { background: #242015; }
  .shop-theme-picker__icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 7px; background: #302a16; color: #f4d77b; }
  .shop-theme-picker__selection { flex: 1; }
  .shop-theme-picker__selection > span, .shop-theme-picker__toggle { color: #c7b77f; }
  .shop-theme-picker__selection strong { color: #fff3c4; }
  .shop-theme-picker__toggle .shop-icon { width: 30px; height: 30px; padding: 6px; border-radius: 50%; background: #302a16; color: #f4d77b; }
  .shop-theme-list { overscroll-behavior-y: auto; }
}
@media (max-width: 560px) {
  .shop-page { gap: 1rem; }
  .shop-hero { gap: .6rem; }
  .shop-hero h1 { font-size: 1.6rem; }
  .shop-balance-card { min-width: 118px; padding: .55rem .65rem; }
  .shop-balance-card__label { font-size: .63rem; }
  .shop-balance-card__label .shop-icon { width: 14px; height: 14px; }
  .shop-layout { grid-template-columns: 1fr; gap: .8rem; }
  .shop-sidebar { position: static; }
  .shop-sidebar h2 { margin-bottom: .35rem; }
  .shop-types { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shop-type { min-height: 36px; font-size: .74rem; }
  .shop-catalog { gap: .75rem; }
  .shop-theme-picker__summary { padding: .75rem; gap: .6rem; }
  .shop-theme-picker__body { padding: .65rem; }
  .shop-theme-list { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 280px; }
  .shop-theme-option { padding: .5rem; font-size: .74rem; }
  .shop-theme-picker__toggle { gap: .3rem; font-size: .68rem; }
  .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
  .shop-product-card__preview { height: 136px; }
  .shop-layout[aria-busy="true"] .shop-product-card__preview::after { max-width: 96px; }
  .shop-product-card__preview-art, .shop-preview-frame { width: 112px; height: 112px; }
  .shop-product-card__body { padding: .6rem; gap: .55rem; }
  .shop-product-card h3 { font-size: .82rem; }
  .shop-product-card__description { font-size: .68rem; }
  .shop-product-card__meta { flex-wrap: wrap; }
  .shop-product-card__price strong { font-size: .9rem; }
  .shop-stock { font-size: .6rem; }
  .shop-action, .shop-owned-note { font-size: .7rem; gap: .3rem; }
  .shop-pagination { gap: .35rem; flex-wrap: wrap; }
  .shop-pagination .admin-pagination__numbers { gap: .2rem; }
  .shop-pagination .button, .shop-pagination .chip { min-width: 30px; min-height: 32px; padding: .3rem .45rem; font-size: .7rem; }
}
@media (max-width: 360px) {
  .shop-grid, .shop-theme-list { grid-template-columns: 1fr; }
  .shop-theme-picker__toggle > span { display: none; }
}
