/* ============================================================
   Marketplace pages
   Warm paper, ledger rails, and tactile cards
   ============================================================ */

:root {
  --paper: #f7f1e6;
  --paper-2: #efe3d2;
  --card: #fffaf2;
  --card-2: #f8f2e8;
  --ink: #211912;
  --soft: #695d52;
  --soft-2: #8a7d71;
  --pine: #315743;
  --moss: #6e8456;
  --clay: #bb644c;
  --brass: #a97b3d;
  --line: rgba(41, 28, 18, 0.12);
  --line-strong: rgba(41, 28, 18, 0.2);
  --shadow: 0 20px 50px rgba(56, 37, 23, 0.08);
  --shadow-strong: 0 26px 60px rgba(56, 37, 23, 0.14);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

html {
  scroll-behavior: smooth;
}

body.market-body {
  background:
    radial-gradient(circle at 0% 0%, rgba(187, 100, 76, 0.08), transparent 28%),
    radial-gradient(circle at 100% 0%, rgba(169, 123, 61, 0.1), transparent 24%),
    radial-gradient(circle at 100% 100%, rgba(49, 87, 67, 0.08), transparent 28%),
    linear-gradient(180deg, #faf4ea 0%, #f6efe3 42%, #f4ecdf 100%);
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  line-height: 1.65;
}

.market-page {
  position: relative;
  overflow: clip;
}

.market-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(41, 28, 18, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(41, 28, 18, 0.03) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.26), transparent 72%);
  opacity: 0.4;
}

.market-nav {
  background: rgba(247, 241, 230, 0.92);
  border-bottom: 1px solid rgba(41, 28, 18, 0.08);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.72) inset;
}

.market-nav .logo {
  color: var(--ink);
}

.market-nav .logo-mark {
  filter: saturate(0.72) sepia(0.25);
}

.market-frame {
  max-width: 1360px;
  margin: 0 auto;
  padding: 96px 5vw 84px;
  position: relative;
  z-index: 1;
}

.market-hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 28px;
  align-items: end;
  margin-bottom: 28px;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--clay);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 14px;
}

.hero-kicker::before {
  content: "";
  width: 46px;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
}

.market-hero h1,
.detail-title {
  font-family: "Songti SC", "Noto Serif SC", "STSong", serif;
  font-weight: 800;
  letter-spacing: 0.01em;
  font-size: clamp(26px, 3vw, 40px);
  line-height: 1.2;
  margin-bottom: 14px;
}

.market-hero h1 {
  font-size: clamp(38px, 5vw, 72px);
  line-height: 1.04;
  max-width: 10.5ch;
  margin-bottom: 18px;
}

.hero-copy p {
  max-width: 52ch;
  font-size: 16px;
  color: var(--soft);
  margin-bottom: 22px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.market-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(49, 87, 67, 0.08);
  color: var(--pine);
  font-size: 13px;
  font-weight: 700;
}

.stats-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 250, 243, 0.96), rgba(247, 239, 228, 0.98));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px;
  min-height: 136px;
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -38px;
  bottom: -46px;
  width: 168px;
  height: 168px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(187, 100, 76, 0.14), transparent 68%);
  pointer-events: none;
}

.stat-card.featured {
  grid-column: 1 / -1;
  min-height: 182px;
  background:
    linear-gradient(180deg, rgba(255, 250, 243, 0.98), rgba(245, 236, 223, 0.96)),
    linear-gradient(135deg, rgba(49, 87, 67, 0.05), transparent 58%);
}

.stat-label {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--soft-2);
  margin-bottom: 8px;
}

.stat-value {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  font-family: "Songti SC", "Noto Serif SC", serif;
  font-size: clamp(34px, 4vw, 54px);
  line-height: 1;
  font-weight: 700;
  color: var(--ink);
}

.stat-value small {
  font-size: 13px;
  color: var(--soft);
  font-family: "PingFang SC", sans-serif;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.stat-caption {
  margin-top: 12px;
  color: var(--soft);
  font-size: 14px;
}

.category-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.category-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.category-pill b {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--clay);
}

.market-grid {
  display: grid;
  grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.panel {
  background: rgba(255, 250, 244, 0.92);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.panel-inner {
  padding: 22px;
}

.panel-sticky {
  position: sticky;
  top: 82px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-head h2,
.section-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.panel-subtitle {
  margin-top: 4px;
  font-size: 13px;
  color: var(--soft);
}

.panel-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(49, 87, 67, 0.08);
  color: var(--pine);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.panel-chip::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
}

.field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.field-hint {
  font-size: 12px;
  color: var(--soft-2);
}

.field select,
.field input,
.field textarea {
  width: 100%;
  border: 1.5px solid rgba(41, 28, 18, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
}

.field input,
.field select {
  padding: 12px 14px;
}

/* 品类选择框：去掉系统默认箭头，使用自定义样式 */
.field select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 44px;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M6 9l6 6 6-6' stroke='%23bb644c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 18px 18px;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(41, 28, 18, 0.04);
}

.field select:hover {
  border-color: rgba(49, 87, 67, 0.28);
}

/* 未选择分类时显示占位灰色 */
.field select:required:invalid {
  color: #a59a8f;
}

.field select option {
  color: var(--ink);
  background: #fffaf2;
  padding: 8px 10px;
}

.field textarea {
  min-height: 120px;
  resize: vertical;
  padding: 14px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--pine);
  box-shadow: 0 0 0 4px rgba(49, 87, 67, 0.11);
}

.field input::placeholder,
.field textarea::placeholder {
  color: #a59a8f;
}

.field .compact-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--soft-2);
}

.upload-dropzone {
  position: relative;
  border: 1.5px dashed rgba(49, 87, 67, 0.28);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(249, 244, 236, 0.95), rgba(245, 237, 227, 0.92));
  padding: 18px;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.upload-dropzone:hover {
  border-color: var(--pine);
  box-shadow: 0 12px 30px rgba(49, 87, 67, 0.08);
  transform: translateY(-1px);
}

.upload-dropzone.dragover {
  border-color: var(--clay);
  box-shadow: 0 0 0 4px rgba(187, 100, 76, 0.12);
}

.upload-dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-copy {
  display: flex;
  gap: 14px;
  align-items: center;
}

.upload-icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: rgba(49, 87, 67, 0.12);
  color: var(--pine);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.upload-copy h3 {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 2px;
}

.upload-copy p {
  font-size: 13px;
  color: var(--soft);
}

.preview-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.preview-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background: #eadfce;
  border: 1px solid rgba(41, 28, 18, 0.08);
}

.preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-thumb button {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: rgba(33, 25, 18, 0.78);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.preview-empty {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--soft-2);
  font-size: 13px;
  border: 1px solid rgba(41, 28, 18, 0.06);
}

.upload-progress {
  margin-top: 12px;
  display: none;
}

.upload-progress.active {
  display: block;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--soft);
  margin-bottom: 8px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(41, 28, 18, 0.08);
  overflow: hidden;
}

.progress-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--pine), var(--clay));
  transition: width 0.24s ease;
}

.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
}

.btn-market,
.btn-market-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 800;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.btn-market {
  background: linear-gradient(135deg, #D97059 0%, #C5604A 100%);
  color: #fff;
  box-shadow: 0 10px 22px rgba(217, 112, 89, 0.28);
}

.btn-market:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(217, 112, 89, 0.36);
}

.btn-market:active {
  transform: translateY(0);
  box-shadow: 0 6px 14px rgba(217, 112, 89, 0.24);
}

.btn-market-secondary {
  background: rgba(255, 255, 255, 0.72);
  color: var(--pine);
  border-color: rgba(49, 87, 67, 0.22);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.btn-market-secondary:hover {
  transform: translateY(-2px);
  background: rgba(232, 240, 235, 0.85);
  border-color: rgba(49, 87, 67, 0.38);
  box-shadow: 0 8px 18px rgba(49, 87, 67, 0.12);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.search-wrap {
  min-width: min(100%, 280px);
  position: relative;
}

.search-wrap input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border-radius: 999px;
  border: 1px solid rgba(41, 28, 18, 0.12);
  background: rgba(255, 255, 255, 0.92);
  font-size: 14px;
  outline: none;
}

.search-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--soft-2);
}

.filter-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-chip {
  border: 1px solid rgba(41, 28, 18, 0.1);
  background: rgba(255, 255, 255, 0.78);
  color: var(--soft);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.filter-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(49, 87, 67, 0.22);
  color: var(--pine);
}

.filter-chip.active {
  background: var(--pine);
  color: #fff8ef;
  border-color: var(--pine);
}

.sort-select {
  min-width: 160px;
}

.sort-select select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 999px;
  border: 1px solid rgba(41, 28, 18, 0.12);
  background: rgba(255, 255, 255, 0.92);
  font-size: 14px;
  color: var(--ink);
}

.catalog-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--soft);
}

.catalog-summary strong {
  color: var(--ink);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.product-card {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 250, 244, 0.98), rgba(248, 241, 230, 0.98));
  border: 1px solid rgba(41, 28, 18, 0.1);
  box-shadow: var(--shadow);
  transition: transform 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease;
  cursor: pointer;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-strong);
  border-color: rgba(49, 87, 67, 0.18);
}

.product-image {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #e9ddcb;
  overflow: hidden;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1);
  transition: transform 0.45s ease;
}

.product-card:hover .product-image img {
  transform: scale(1.045);
}

.product-image::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 68px;
  background: linear-gradient(180deg, transparent, rgba(26, 18, 12, 0.42));
}

.product-badge {
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 250, 243, 0.92);
  border: 1px solid rgba(41, 28, 18, 0.08);
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
}

.product-seller-badge {
  position: absolute;
  left: 14px;
  top: 52px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(49, 87, 67, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 11px;
  font-weight: 700;
  color: #fff8ef;
  max-width: calc(100% - 28px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-seller-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 248, 239, 0.9);
  flex-shrink: 0;
}

.product-body {
  padding: 16px 16px 18px;
}

.product-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.product-user {
  font-size: 11px;
  color: var(--soft-2);
}

.product-time {
  font-size: 11px;
  color: var(--soft-2);
  opacity: 0.75;
  white-space: nowrap;
}

.product-name {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 10px;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  margin-bottom: 10px;
  font-size: 20px;
  line-height: 1;
  color: var(--clay);
  font-weight: 700;
  font-family: "Songti SC", "Noto Serif SC", serif;
}

.product-price small {
  font-size: 12px;
  font-family: "PingFang SC", sans-serif;
  color: var(--soft);
  font-weight: 500;
}

.product-desc {
  font-size: 13px;
  color: var(--soft);
  line-height: 1.65;
  min-height: 42px;
}

.product-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
}

.product-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--pine);
  font-size: 13px;
  font-weight: 800;
}

.empty-state,
.error-state {
  grid-column: 1 / -1;
  padding: 34px;
  border-radius: 24px;
  border: 1px dashed rgba(41, 28, 18, 0.16);
  background: rgba(255, 250, 243, 0.76);
  color: var(--soft);
}

.empty-state h3,
.error-state h3 {
  font-size: 20px;
  color: var(--ink);
  margin-bottom: 8px;
}

.empty-state p,
.error-state p {
  max-width: 56ch;
}

.loading-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.skeleton-card {
  overflow: hidden;
  border-radius: 16px;
  background: rgba(255, 250, 243, 0.82);
  border: 1px solid rgba(41, 28, 18, 0.08);
  box-shadow: var(--shadow);
}

.skeleton-media {
  aspect-ratio: 4 / 3;
  background: linear-gradient(90deg, #ece2d2 0%, #f7f0e6 50%, #ece2d2 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
}

.skeleton-body {
  padding: 16px;
}

.skeleton-line {
  height: 12px;
  border-radius: 999px;
  margin-bottom: 10px;
  background: linear-gradient(90deg, #ece2d2 0%, #f7f0e6 50%, #ece2d2 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
}

.skeleton-line.short {
  width: 38%;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.detail-frame {
  padding-top: 96px;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 24px;
  align-items: start;
}

.detail-media,
.detail-panel {
  background: rgba(255, 250, 244, 0.94);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.detail-media {
  overflow: hidden;
}

.detail-gallery {
  padding: 18px;
  text-align: center;
}

.detail-main-image {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #e9ddcb;
  line-height: 0;
  display: inline-block;
}

.detail-main-image img {
  max-width: 100%;
  height: auto;
  max-height: 520px;
  display: block;
}

.detail-thumbs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.detail-thumb {
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(41, 28, 18, 0.08);
  cursor: pointer;
  background: #e9ddcb;
  opacity: 0.7;
  transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.detail-thumb.active,
.detail-thumb:hover {
  opacity: 1;
  transform: translateY(-1px);
  border-color: rgba(49, 87, 67, 0.26);
}

.detail-thumb.active {
  background: #fff;
}

.detail-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.detail-panel {
  padding: 24px;
}

.publish-page .market-hero {
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 18px;
}

.publish-page .hero-copy {
  max-width: 760px;
}

.publish-page .market-hero h1 {
  max-width: 13ch;
  font-size: clamp(32px, 4vw, 54px);
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.publish-page .hero-copy p {
  max-width: 46ch;
}

.publish-page .hero-actions {
  margin-top: 16px;
}

.detail-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--soft);
  font-size: 13px;
  margin-bottom: 12px;
}

.detail-breadcrumb a {
  color: var(--pine);
  font-weight: 700;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.detail-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(41, 28, 18, 0.1);
  background: rgba(255, 255, 255, 0.8);
  color: var(--soft);
  font-size: 12px;
  font-weight: 700;
}

.detail-tag strong {
  color: var(--ink);
}

.detail-price {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-family: "Songti SC", "Noto Serif SC", serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--clay);
  margin-bottom: 14px;
}

.detail-price small {
  font-family: "PingFang SC", sans-serif;
  font-size: 13px;
  color: var(--soft);
}

.detail-summary {
  padding: 16px 0 18px;
  border-top: 1px solid rgba(41, 28, 18, 0.08);
  border-bottom: 1px solid rgba(41, 28, 18, 0.08);
  margin-bottom: 18px;
}

.detail-summary h2 {
  font-size: 30px;
  line-height: 1.25;
  margin-bottom: 12px;
  font-family: "Songti SC", "Noto Serif SC", serif;
  font-weight: 800;
}

.detail-summary p {
  color: var(--soft);
}

.detail-specs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.spec-card {
  border-radius: 18px;
  border: 1px solid rgba(41, 28, 18, 0.08);
  background: rgba(247, 241, 230, 0.72);
  padding: 14px;
}

.spec-card span {
  display: block;
  color: var(--soft-2);
  font-size: 12px;
  margin-bottom: 4px;
}

.spec-card strong {
  font-size: 14px;
  color: var(--ink);
}

.detail-copy {
  display: grid;
  gap: 10px;
}

.detail-copy p {
  color: var(--soft);
}

.detail-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.detail-empty {
  max-width: 640px;
  margin: 0 auto;
  padding: 140px 24px 90px;
  text-align: center;
}

.detail-empty h1 {
  font-size: clamp(34px, 5vw, 58px);
  margin-bottom: 12px;
}

.detail-empty p {
  color: var(--soft);
  margin-bottom: 20px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(16px);
  background: rgba(33, 25, 18, 0.94);
  color: #fff7ea;
  border-radius: 999px;
  padding: 12px 16px;
  box-shadow: 0 16px 28px rgba(33, 25, 18, 0.26);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 120;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.loading-surface {
  pointer-events: none;
}

.field textarea,
.field input,
.field select,
.search-wrap input,
.sort-select select {
  font-family: inherit;
}

.nav .logged-in-user {
  font-size: 13px;
  color: var(--soft);
}

.nav .logged-in-user::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--clay);
  margin-right: 8px;
}

@media (max-width: 1120px) {
  .market-hero {
    grid-template-columns: 1fr;
  }

  .stats-board {
    order: -1;
  }
}

@media (max-width: 960px) {
  .market-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .panel-sticky {
    position: static;
  }

  .product-grid,
  .loading-grid {
    grid-template-columns: 1fr;
  }

  .detail-thumbs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .market-frame,
  .detail-frame {
    padding-top: 84px;
    padding-bottom: 64px;
  }

  .panel-inner,
  .detail-panel {
    padding: 18px;
  }

  .toolbar {
    align-items: stretch;
  }

  .sort-select,
  .search-wrap {
    min-width: 100%;
  }

  .detail-specs {
    grid-template-columns: 1fr;
  }

  .preview-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .detail-thumbs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .market-hero h1 {
    max-width: none;
  }

  .hero-actions,
  .form-actions,
  .detail-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-market,
  .btn-market-secondary {
    width: 100%;
  }

  .preview-strip,
  .detail-thumbs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-board {
    grid-template-columns: 1fr;
  }
}

/* ── 商品广场分页标签（商品列表 / 我发布的）── */
.market-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(41, 28, 18, 0.08);
  padding-bottom: 12px;
}

.market-tab {
  border: 1px solid rgba(41, 28, 18, 0.1);
  background: rgba(255, 255, 255, 0.78);
  color: var(--soft);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.market-tab:hover {
  transform: translateY(-1px);
  border-color: rgba(49, 87, 67, 0.22);
  color: var(--pine);
}

.market-tab.active {
  background: var(--pine);
  color: #fff8ef;
  border-color: var(--pine);
}

/* ── 我发布的商品管理卡片 ── */
.my-products-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.my-product-card {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 250, 244, 0.98), rgba(248, 241, 230, 0.98));
  border: 1px solid rgba(41, 28, 18, 0.1);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow 0.24s ease, border-color 0.24s ease;
}

.my-product-card:hover {
  box-shadow: var(--shadow-strong);
  border-color: rgba(49, 87, 67, 0.18);
}

.my-product-card.is-sold {
  opacity: 0.92;
}

.my-product-media {
  position: relative;
  display: block;
  background: #e9ddcb;
  min-height: 150px;
}

.my-product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.my-product-card.is-sold .my-product-media img {
  filter: grayscale(0.65);
}

.my-sold-mask {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(33, 25, 18, 0.45);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.2em;
  font-size: 15px;
}

.my-product-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.my-product-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.my-product-name {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--ink);
}

.my-status {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.my-status-active {
  background: rgba(49, 87, 67, 0.12);
  color: var(--pine);
}

.my-status-sold {
  background: rgba(187, 100, 76, 0.14);
  color: var(--clay);
}

.my-product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--soft);
}

.my-product-price {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 20px;
  font-weight: 800;
  color: var(--clay);
  font-family: "Songti SC", "Noto Serif SC", serif;
}

.my-product-price small {
  font-size: 12px;
  font-family: "PingFang SC", sans-serif;
  color: var(--soft);
}

.my-price-input {
  width: 110px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1.5px solid rgba(41, 28, 18, 0.14);
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.my-price-input:focus {
  border-color: var(--pine);
  box-shadow: 0 0 0 4px rgba(49, 87, 67, 0.11);
}

.my-product-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
}

.my-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 800;
  border: 1px solid rgba(41, 28, 18, 0.12);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.my-action-btn:hover {
  transform: translateY(-1px);
}

.my-action-btn.my-sold {
  background: linear-gradient(135deg, #D97059 0%, #C5604A 100%);
  color: #fff;
  border-color: transparent;
}

.my-action-btn.my-resell {
  background: linear-gradient(135deg, var(--pine), #3d6b52);
  color: #fff;
  border-color: transparent;
}

.my-action-btn.my-view:hover {
  border-color: rgba(49, 87, 67, 0.38);
  color: var(--pine);
}

.my-action-btn.my-delete {
  background: linear-gradient(135deg, #a94442 0%, #8f3432 100%);
  color: #fff;
  border-color: transparent;
}

.my-action-btn.my-delete:hover {
  background: linear-gradient(135deg, #b8504e 0%, #9c3a38 100%);
}

.my-action-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* ── 移动端：我发布的商品卡片适配 ──
   这些覆盖规则必须放在基础 .my-product-* 样式之后，
   否则会被后面的基础样式按源顺序覆盖，导致移动端布局混乱。 */
@media (max-width: 960px) {
  .my-products-grid {
    grid-template-columns: 1fr;
  }

  .my-product-card {
    grid-template-columns: 1fr;
  }

  .my-product-media {
    aspect-ratio: 16 / 9;
    min-height: 0;
    max-height: 210px;
  }

  .my-product-price {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .my-price-input {
    width: auto;
    flex: 1 1 96px;
    min-width: 90px;
  }
}

@media (max-width: 520px) {
  .my-product-actions .my-action-btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  .my-product-topline {
    flex-wrap: wrap;
  }
}

/* 已售出商品详情页提醒 */
.sold-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.3);
  color: #dc2626;
  font-weight: 800;
  font-size: 15px;
  margin-bottom: 16px;
}

.sold-notice svg {
  flex-shrink: 0;
}

/* ── 按钮加载状态 ── */
.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.85;
}

.btn-loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

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

/* 联系卖家按钮 */
.btn-contact-seller {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 800;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--pine), #3d6b52);
  color: #fff;
  box-shadow: 0 14px 24px rgba(49, 87, 67, 0.24);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn-contact-seller:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(49, 87, 67, 0.3);
}

.btn-contact-seller:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.btn-contact-seller svg {
  width: 18px;
  height: 18px;
}

.btn-contact-seller.btn-loading {
  background: linear-gradient(135deg, #4a7a62, #5a8a72);
}

/* ── 自定义确认弹窗（删除商品等）── */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(33, 25, 18, 0.42);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.confirm-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* 确保 hidden 属性能真正隐藏遮罩：display:flex 会覆盖 hidden 默认的 display:none */
.confirm-overlay[hidden] {
  display: none;
}

.confirm-dialog {
  width: min(420px, 100%);
  background: linear-gradient(180deg, #fffaf2, #f8f2e8);
  border: 1px solid rgba(41, 28, 18, 0.1);
  border-radius: 18px;
  box-shadow: var(--shadow-strong);
  padding: 26px 24px 22px;
  text-align: center;
  position: relative;
  transform: translateY(14px) scale(0.97);
  transition: transform 0.22s ease;
}

.confirm-overlay.show .confirm-dialog {
  transform: translateY(0) scale(1);
}

.confirm-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--soft-2);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.confirm-close:hover {
  background: rgba(41, 28, 18, 0.08);
  color: var(--ink);
  transform: rotate(90deg);
}

.confirm-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(169, 68, 66, 0.12);
  color: #a94442;
}

.confirm-title {
  font-family: "Songti SC", "Noto Serif SC", "STSong", serif;
  font-size: 21px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 8px;
}

.confirm-text {
  color: var(--soft);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 22px;
}

.confirm-text strong {
  color: var(--ink);
  font-weight: 800;
}

.confirm-actions {
  display: flex;
  gap: 12px;
}

.confirm-btn {
  flex: 1;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.confirm-btn:hover {
  transform: translateY(-1px);
}

.confirm-cancel {
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  border-color: rgba(41, 28, 18, 0.14);
}

.confirm-cancel:hover {
  border-color: rgba(49, 87, 67, 0.38);
  color: var(--pine);
}

.confirm-ok {
  background: linear-gradient(135deg, #a94442 0%, #8f3432 100%);
  color: #fff;
  box-shadow: 0 12px 22px rgba(169, 68, 66, 0.26);
}

.confirm-ok:hover {
  background: linear-gradient(135deg, #b8504e 0%, #9c3a38 100%);
  box-shadow: 0 14px 26px rgba(169, 68, 66, 0.32);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
