:root {
  --yellow: #ffc928;
  --yellow-soft: #fff5ce;
  --yellow-pale: #fffaf0;
  --ink: #252525;
  --muted: #88847f;
  --line: #eeeae4;
  --page: #ffffff;
  --soft: #f7f7f5;
  --shadow: 0 8px 24px rgba(53, 45, 29, .07);
}

* { box-sizing: border-box; }
html { background: var(--page); }
body { margin: 0; color: var(--ink); background: var(--page); font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; }
button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
.screen { min-height: 100vh; padding-bottom: calc(78px + env(safe-area-inset-bottom)); background: #fff; }

.catalog-header { max-width: 1120px; margin: 0 auto; padding: calc(14px + env(safe-area-inset-top)) 20px 14px; }
.search { min-height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 17px; border-radius: 999px; background: #f4f4f3; }
.search svg { flex: 0 0 auto; width: 25px; height: 25px; fill: none; stroke: #918c87; stroke-width: 2; stroke-linecap: round; }
.search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 16px; }
.search input::placeholder { color: #a19d99; opacity: 1; }
.search button { min-height: 38px; padding: 0 15px; border: 0; border-radius: 999px; background: var(--yellow); font-weight: 800; cursor: pointer; }

.catalog-shell { max-width: 1120px; min-height: 620px; margin: 0 auto; display: grid; grid-template-columns: 166px minmax(0, 1fr); border-top: 1px solid #f4f1ed; }
.category-nav { align-self: stretch; padding: 20px 12px 110px; border-right: 1px solid #f1eee9; background: linear-gradient(90deg, #fff, #fdfdfc); }
.category-button { position: relative; width: 100%; min-height: 54px; margin-bottom: 8px; padding: 10px 12px; border: 0; border-radius: 18px; background: transparent; font-size: 16px; font-weight: 650; text-align: left; cursor: pointer; }
.category-button.active { background: linear-gradient(90deg, #fff7dd, #fff0b5); font-weight: 900; }
.category-button.active::before { position: absolute; top: 50%; left: -12px; width: 5px; height: 26px; border-radius: 0 5px 5px 0; background: var(--yellow); content: ""; transform: translateY(-50%); }

.catalog-content { min-width: 0; padding: 26px 20px 40px; }
.content-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.content-heading h2 { margin: 0; font-size: 25px; letter-spacing: -.02em; }
.content-heading span { color: #99938d; font-size: 14px; white-space: nowrap; }
.filter-tabs { display: flex; gap: 10px; margin-top: 16px; padding-bottom: 4px; overflow-x: auto; scrollbar-width: none; }
.filter-tabs::-webkit-scrollbar { display: none; }
.filter-button { flex: 0 0 auto; min-width: 74px; min-height: 38px; padding: 0 16px; border: 0; border-radius: 999px; background: #f4f4f3; font-size: 14px; cursor: pointer; }
.filter-button.active { background: var(--yellow); font-weight: 900; }
.topic-panel { margin-top: 12px; padding: 11px 12px; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 9px 12px; border: 1px solid #f0ebe2; border-radius: 14px; background: #fcfbf8; }
.topic-panel[hidden] { display: none; }
.topic-label { min-height: 30px; display: inline-flex; align-items: center; gap: 6px; color: #9a8f80; font-size: 12px; font-weight: 700; white-space: nowrap; }
.topic-label::before { width: 5px; height: 5px; border-radius: 50%; background: var(--yellow); content: ""; box-shadow: 0 0 0 3px #fff2bf; }
.topic-tabs { min-width: 0; display: flex; flex-wrap: wrap; gap: 7px; }
.topic-button { min-width: 56px; min-height: 30px; padding: 0 11px; border: 1px solid #ebe6de; border-radius: 999px; background: #fff; color: #625d55; font-size: 13px; line-height: 1; cursor: pointer; transition: border-color .16s ease, background-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease; }
.topic-button:hover { border-color: #e6c75b; background: #fffaf0; color: #654d00; transform: translateY(-1px); }
.topic-button:focus-visible { outline: 3px solid rgba(255, 201, 40, .28); outline-offset: 2px; }
.topic-button.active { border-color: #efbd1e; background: #fff3bf; color: #493700; font-weight: 800; box-shadow: 0 2px 7px rgba(180, 130, 0, .12); }
.topic-result-heading { margin-top: 16px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.topic-result-heading strong { font-size: 16px; }
.topic-result-heading span { color: #99938d; font-size: 13px; white-space: nowrap; }
.product-list { margin-top: 18px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease; }
.card:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(53, 45, 29, .11); }
.card-link { display: block; }
.product-media { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: #faf9f6; border-bottom: 1px solid var(--line); }
.product-media img { width: 100%; height: 100%; display: block; object-fit: contain; }
.unlock-badge { position: absolute; top: 9px; right: 9px; min-height: 26px; padding: 0 9px; display: inline-flex; align-items: center; border: 1px solid rgba(255,255,255,.8); border-radius: 999px; background: rgba(22,163,74,.92); color: #fff; font-size: 11px; font-weight: 900; box-shadow: 0 4px 14px rgba(20,83,45,.2); backdrop-filter: blur(8px); }
.card h3 { margin: 0; padding: 12px 13px 14px; overflow: hidden; font-size: 15px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.card-category { margin: -7px 13px 13px; display: block; overflow: hidden; color: #a47700; font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.card-category:hover { color: #715300; text-decoration: underline; }
.empty-list { grid-column: 1 / -1; min-height: 230px; padding: 28px; display: grid; place-items: center; border: 1px dashed #e7dfd1; border-radius: 18px; background: #fffdf8; color: #938b7e; font-size: 14px; line-height: 1.7; text-align: center; }
.loading-card { min-height: 220px; border-radius: 16px; background: linear-gradient(100deg, #f7f5f1 25%, #fff 45%, #f7f5f1 65%); background-size: 300% 100%; animation: loading 1.3s infinite; }
@keyframes loading { to { background-position: -150% 0; } }

.contact-float { position: fixed; z-index: 8; right: max(18px, calc((100vw - 1120px) / 2 + 18px)); bottom: calc(92px + env(safe-area-inset-bottom)); width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid #f0d36d; border-radius: 50%; background: #fff8dc; color: #7c6110; font-size: 12px; font-weight: 900; box-shadow: var(--shadow); }
.tabbar { position: fixed; z-index: 10; right: 0; bottom: 0; left: 0; height: calc(72px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(2, minmax(0, 220px)); justify-content: center; border-top: 1px solid #eeeae4; background: rgba(255, 255, 255, .96); box-shadow: 0 -6px 22px rgba(53, 45, 29, .04); backdrop-filter: blur(14px); }
.navitem { display: grid; place-content: center; justify-items: center; gap: 4px; color: #79736d; font-size: 12px; font-weight: 700; }
.navitem svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.navitem.active { color: #e9ad00; }
.navitem.active svg rect { fill: var(--yellow); stroke: var(--yellow); }

.preview-layer { display: none; position: fixed; z-index: 30; inset: 0; padding: 58px 12px 100px; background: rgba(30, 28, 24, .82); }
.preview-layer.is-open { display: grid; align-items: center; justify-items: center; }
.preview-close { position: fixed; z-index: 2; top: calc(14px + env(safe-area-inset-top)); left: 14px; width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.35); border-radius: 50%; background: rgba(255,255,255,.16); color: #fff; font-size: 30px; line-height: 1; cursor: pointer; }
.preview-status { display: none; grid-area: 1 / 1; min-width: 150px; padding: 18px 22px; align-items: center; justify-items: center; gap: 11px; border-radius: 14px; background: rgba(20, 18, 15, .72); color: #fff; font-size: 14px; font-weight: 700; text-align: center; backdrop-filter: blur(8px); }
.preview-layer.is-loading .preview-status,
.preview-layer.is-error .preview-status { display: grid; }
.preview-spinner { width: 34px; height: 34px; border: 3px solid rgba(255,255,255,.28); border-top-color: var(--yellow); border-radius: 50%; animation: preview-spin .75s linear infinite; }
.preview-layer.is-error .preview-spinner { display: none; }
.preview-full { grid-area: 1 / 1; max-width: min(100%, 820px); max-height: calc(100vh - 180px); display: block; border-radius: 10px; background: #fff; object-fit: contain; box-shadow: 0 20px 60px rgba(0,0,0,.28); transition: opacity .18s ease; }
.preview-layer.is-loading .preview-full,
.preview-layer.is-error .preview-full { opacity: 0; }
.preview-unlock-badge { display: none; position: fixed; z-index: 2; top: calc(18px + env(safe-area-inset-top)); right: 14px; min-height: 34px; padding: 0 13px; align-items: center; border: 1px solid rgba(255,255,255,.7); border-radius: 999px; background: rgba(22,163,74,.92); color: #fff; font-size: 13px; font-weight: 900; box-shadow: 0 7px 18px rgba(20,83,45,.25); backdrop-filter: blur(8px); }
.preview-unlock-badge.is-visible { display: inline-flex; }
.preview-download { position: fixed; right: 14px; bottom: calc(18px + env(safe-area-inset-bottom)); left: 14px; min-height: 54px; display: grid; place-items: center; border-radius: 16px; background: var(--yellow); color: #302400; font-size: 16px; font-weight: 900; box-shadow: 0 12px 30px rgba(255, 201, 40, .25); }

@keyframes preview-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .preview-spinner { animation-duration: 1.5s; }
  .preview-full { transition: none; }
}

@media (max-width: 760px) {
  .catalog-header { padding-right: 14px; padding-left: 14px; }
  .catalog-shell { grid-template-columns: 112px minmax(0, 1fr); }
  .category-nav { padding: 14px 8px 100px; }
  .category-button { min-height: 52px; padding: 9px 8px; border-radius: 15px; font-size: 14px; }
  .category-button.active::before { left: -8px; }
  .catalog-content { padding: 20px 12px 34px; }
  .product-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
  .card { border-radius: 12px; }
  .card h3 { padding: 10px 9px 12px; font-size: 13px; }
  .card-category { margin: -6px 9px 10px; font-size: 11px; }
}

@media (max-width: 430px) {
  .catalog-header { padding-top: calc(10px + env(safe-area-inset-top)); padding-bottom: 10px; }
  .search { min-height: 50px; }
  .search button { display: none; }
  .catalog-shell { grid-template-columns: 100px minmax(0, 1fr); }
  .content-heading h2 { font-size: 21px; }
  .filter-button { min-width: 62px; min-height: 36px; padding: 0 13px; font-size: 13px; }
  .topic-panel { margin-top: 10px; padding: 10px; grid-template-columns: 1fr; gap: 7px; border-radius: 12px; }
  .topic-label { min-height: auto; padding-left: 3px; }
  .topic-tabs { gap: 6px; }
  .topic-button { min-width: 52px; min-height: 30px; padding: 0 10px; font-size: 12px; }
  .topic-result-heading { margin-top: 14px; }
  .product-list { margin-top: 14px; gap: 9px; }
}
