:root {
  --market-ground: #eef3fb;
  --market-surface: #ffffff;
  --market-text: #182236;
  --market-muted: #667085;
  --market-faint: #667085;
  --market-border: #dce1e8;
  --market-rule: #e5e8ed;
  --market-control: #cbd2dd;
  --market-active: #eef2ff;
  --market-primary: #182236;
  --market-accent: #3458e6;
}

* { box-sizing: border-box; }
html { background: var(--market-ground); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
body.marketplace-page {
  margin: 0;
  overflow-x: clip;
  background-color: var(--market-ground);
  background-image: linear-gradient(to bottom, transparent 55%, #eef3fb 78%, #eef3fb 100%), url("./assets/coco-paper-field-v1.jpg"); /* taste-skill-ignore: exact homepage image fade */
  background-repeat: no-repeat, no-repeat;
  background-position: center top, center top;
  background-size: 100% calc(max(56.28vw, 780px) + 200px), max(100vw, 1386px) auto;
  color: var(--market-text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
body.marketplace-page ::selection { background: #dce4ff; color: #101a31; }
.marketplace-page .site-header {
  position: relative;
  border-bottom: 0;
  background: transparent;
}

.marketplace-main {
  width: min(1240px, calc(100% - 64px));
  min-height: calc(100vh - 72px);
  margin: 0 auto;
  padding: 68px 0 112px;
}

.marketplace-search {
  width: min(208px, 20vw);
  flex: none;
  margin-left: auto;
}
.marketplace-search-control {
  position: relative;
  display: flex;
  align-items: center;
  height: 38px;
  /* taste-skill-ignore: a search field needs a visible control boundary */
  border: 1px solid var(--market-control); /* taste-skill-ignore */
  border-radius: 999px;
  background: var(--market-surface);
}
.marketplace-search-control:focus-within {
  border-color: var(--market-control);
  outline: 0;
}
.marketplace-search-control svg { width: 15px; height: 15px; flex: none; margin-left: 13px; color: #5d687c; }
.marketplace-search-control input {
  min-width: 0;
  flex: 1;
  height: 100%;
  padding: 0 12px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--market-text);
  caret-color: var(--market-accent);
  font: inherit;
  font-size: 13px;
}
.marketplace-search-control input::placeholder { color: #667085; opacity: 1; }
.marketplace-search-clear {
  flex: none;
  min-width: 44px;
  height: 38px;
  margin-right: 3px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--market-muted);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}
.marketplace-search-clear:hover { color: var(--market-text); }

.marketplace-catalog { min-height: 420px; }
.marketplace-catalog-heading {
  margin-bottom: 22px;
}
.marketplace-catalog-heading h1 {
  margin: 0;
  color: var(--market-text);
  font-family: inherit;
  font-size: 36px;
  font-weight: 520;
  line-height: 1.2;
  letter-spacing: -.025em;
}
.marketplace-catalog-heading p {
  margin: 10px 0 0;
  color: var(--market-muted);
  font-size: 14px;
  line-height: 1.5;
}

.marketplace-controls {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: -8px 0 22px;
  padding: 8px 0;
  background: transparent;
}
.marketplace-controls-sentinel { display: block; width: 1px; height: 1px; margin-top: -1px; } /* taste-skill-ignore: invisible sticky-state observer, not a visual divider */
.marketplace-controls.is-stuck { background: var(--market-ground); }
.marketplace-filters {
  display: flex;
  min-width: 0;
  flex: 1;
  gap: 28px;
  margin: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.marketplace-filters::-webkit-scrollbar { display: none; }
.marketplace-filter {
  position: relative;
  display: inline-flex;
  flex: none;
  min-height: 46px;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--market-muted);
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  white-space: nowrap;
  transition: color .16s ease;
}
.marketplace-filter::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: transparent;
  content: "";
}
.marketplace-filter:hover { color: var(--market-text); }
.marketplace-filter[aria-pressed="true"] { color: var(--market-text); font-weight: 600; }
.marketplace-filter[aria-pressed="true"]::after { background: var(--market-accent); }
.marketplace-filter .num {
  margin-left: 6px;
  color: var(--market-faint);
  font-variant-numeric: tabular-nums;
  font-weight: 450;
}

.marketplace-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.marketplace-grid[hidden], .marketplace-state[hidden] { display: none !important; }
.marketplace-card {
  min-width: 0;
  min-height: 198px;
  overflow: clip;
  border: 1px solid rgb(207 219 241 / 78%);
  border-radius: 12px;
  background: linear-gradient(145deg, rgb(253 253 255 / 98%), rgb(241 246 255 / 96%));
  box-shadow: 0 8px 28px rgb(58 92 157 / 7%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform .22s cubic-bezier(.22, 1, .36, 1), border-color .22s ease, box-shadow .22s ease;
}
.marketplace-card:focus-within {
  border-color: rgb(105 133 232 / 72%);
  box-shadow: 0 16px 40px rgb(52 88 230 / 14%);
  transform: translateY(-3px);
}
@media (hover: hover) {
  .marketplace-card:hover {
    border-color: rgb(105 133 232 / 72%);
    box-shadow: 0 16px 40px rgb(52 88 230 / 14%);
    transform: translateY(-3px);
  }
}
.marketplace-card > a, .marketplace-card > div {
  display: flex;
  height: 100%;
  min-height: 196px;
  flex-direction: column;
  padding: 16px 16px 12px;
  color: inherit;
  text-decoration: none;
}
.marketplace-card-head {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.marketplace-card-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}
.marketplace-card h2 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--market-text);
  font-family: inherit;
  font-size: 17px;
  font-weight: 620;
  line-height: 1.35;
  letter-spacing: -.018em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.marketplace-card h2 a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--market-control);
  text-underline-offset: .2em;
}
.marketplace-card h2 a:hover { color: var(--market-accent); text-decoration-color: currentColor; }
.marketplace-card h2 a:focus-visible { outline: 2px solid var(--market-accent); outline-offset: 2px; }
.marketplace-card-types {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 4px;
}
.marketplace-card-type {
  padding: 2px 6px;
  border-radius: 999px;
  background: #dfe8fb;
  color: #4962ad;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
.marketplace-card-downloads {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 1px;
  padding-top: 3px;
  color: var(--market-faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
  white-space: nowrap;
}
.marketplace-card-downloads svg { width: 13px; height: 13px; }
.marketplace-card-description {
  display: -webkit-box;
  height: 44px;
  min-height: 44px;
  max-height: 44px;
  margin: 10px 0 0;
  overflow: hidden;
  color: var(--market-muted);
  font-size: 14px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.marketplace-card-gallery {
  display: flex;
  gap: 8px;
  margin-top: 9px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.marketplace-card-image {
  width: auto;
  min-width: 0;
  height: 46px;
  flex: 0 0 calc((100% - 24px) / 4);
  overflow: hidden;
  padding: 0;
  /* taste-skill-ignore: image thumbnails need a clear interactive boundary */
  border: 1px solid var(--market-border); /* taste-skill-ignore */
  border-radius: 8px;
  background: #f3f6fb;
  cursor: zoom-in;
}
.marketplace-card-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.marketplace-card-image:hover { border-color: #aeb8c7; }
.marketplace-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid rgb(223 229 239 / 78%);
  color: var(--market-faint);
  font-size: 11px;
}
.marketplace-card-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}
.marketplace-card-date {
  flex: none;
  color: #7b8495;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.marketplace-card-action {
  flex: none;
  color: var(--market-accent);
  font-size: 13px;
  font-weight: 400;
  text-decoration: underline;
  text-decoration-color: rgb(52 88 230 / 38%);
  text-underline-offset: 3px;
}
.marketplace-card-action:hover { color: #2446c7; text-decoration-color: currentColor; }

.marketplace-controls[hidden] { display: none; }

.marketplace-guides-link {
  display: inline-block;
  margin-top: 8px;
  color: #294bcc;
  font-size: 14px;
  text-underline-offset: .2em;
}

.marketplace-skeleton { height: 198px; border-radius: 12px; background: rgb(255 255 255 / 58%); }
.marketplace-load-more {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: center;
  color: var(--market-muted);
  font-size: 13px;
}
.marketplace-load-more[hidden] { display: none; }
.marketplace-load-more button {
  min-height: 40px;
  padding: 0 16px;
  /* taste-skill-ignore: pagination recovery needs an explicit button boundary */
  border: 1px solid var(--market-control); /* taste-skill-ignore */
  border-radius: 999px;
  background: #fff;
  color: var(--market-text);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}
.marketplace-state { min-height: 300px; padding: 76px 20px; text-align: center; }
.marketplace-state h3 { margin: 0; color: var(--market-text); font-family: inherit; font-size: 20px; font-weight: 620; line-height: 1.3; }
.marketplace-state p { margin: 12px auto 0; color: var(--market-muted); font-size: 14px; line-height: 1.65; }
.marketplace-state > div { display: flex; justify-content: center; gap: 12px; margin-top: 24px; }
.marketplace-state button, .marketplace-state a {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 17px;
  /* taste-skill-ignore: secondary recovery controls remain outlined */
  border: 1px solid var(--market-control); /* taste-skill-ignore */
  border-radius: 10px;
  background: #fff;
  color: var(--market-text);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.marketplace-state .marketplace-retry { border-color: var(--market-primary); background: var(--market-primary); color: #fff; }
.marketplace-state button:hover, .marketplace-state a:hover { border-color: #9fa9b8; }
.marketplace-state .marketplace-retry:hover { border-color: #29354b; background: #29354b; }

.marketplace-page button:focus-visible,
.marketplace-page input:focus-visible,
.marketplace-page a:focus-visible { outline: 3px solid rgba(52, 88, 230, .24); outline-offset: 3px; }
.marketplace-page .marketplace-search input:focus-visible { outline: 0; }
.marketplace-lightbox {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(10, 15, 26, .94);
  color: #fff;
}
.marketplace-lightbox::backdrop { background: rgba(10, 15, 26, .94); }
.marketplace-lightbox[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.marketplace-lightbox-toolbar {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 24px;
}
.marketplace-lightbox-toolbar > div { display: flex; min-width: 0; align-items: baseline; gap: 12px; }
.marketplace-lightbox-toolbar strong { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.marketplace-lightbox-toolbar span { flex: none; color: #aeb7c7; font-size: 13px; font-variant-numeric: tabular-nums; }
.marketplace-lightbox button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  cursor: pointer;
  font: inherit;
}
.marketplace-lightbox button:hover { background: rgba(255, 255, 255, .2); }
.marketplace-lightbox .marketplace-lightbox-close { width: auto; padding: 0 16px; font-size: 13px; }
.marketplace-lightbox-stage {
  display: grid;
  min-height: 0;
  grid-template-columns: 64px minmax(0, 1fr) 64px;
  align-items: center;
  gap: 18px;
  padding: 12px 24px 32px;
}
.marketplace-lightbox-stage img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}
.marketplace-lightbox-stage button { justify-self: center; font-size: 22px; }
.marketplace-page .site-footer {
  max-width: 1240px;
  margin-top: 24px;
  border-top: 0;
  background: transparent;
}

@media (max-width: 960px) {
  .marketplace-main { width: min(100% - 48px, 1240px); padding-top: 56px; }
  .marketplace-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  body.marketplace-page { background-position: 63% top, 63% top; }
  .marketplace-main { width: calc(100% - 32px); min-height: calc(100vh - 64px); padding: 34px 0 72px; }
  .marketplace-catalog-heading h1 { font-size: 30px; }
  .marketplace-controls { gap: 14px; }
  .marketplace-search { width: min(160px, 42vw); margin-left: 0; }
  .marketplace-search-control { height: 46px; }
  .marketplace-search-clear { height: 46px; }
  .marketplace-filters { gap: 24px; }
  .marketplace-filter { min-height: 44px; }
  .marketplace-grid { grid-template-columns: 1fr; gap: 14px; }
  .marketplace-card { min-height: 198px; }
  .marketplace-card > a, .marketplace-card > div { min-height: 196px; padding: 16px 16px 12px; }
  .marketplace-card-description { height: 44px; min-height: 44px; max-height: 44px; margin-top: 10px; }
  .marketplace-card-image { width: auto; min-width: 0; height: 46px; flex-basis: calc((100% - 24px) / 4); }
  .marketplace-skeleton { height: 198px; }
  .marketplace-state { min-height: 280px; padding: 62px 12px; }
  .marketplace-page .site-footer { margin-top: 0; }
  .marketplace-lightbox-toolbar { min-height: 64px; padding: 10px 16px; }
  .marketplace-lightbox-stage { grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 6px; padding: 8px 8px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .marketplace-filter { transition: none; }
  .marketplace-card { transition: none; }
  .marketplace-card:hover, .marketplace-card:focus-within { transform: none; }
}

@media (prefers-reduced-transparency: reduce) {
  .marketplace-card { background: #f6f8ff; backdrop-filter: none; -webkit-backdrop-filter: none; }
}
