﻿:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1a1a2e;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --border: #e5e7eb;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,.06);
  --max-w: 960px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; display: block; }

.container {
  width: min(100% - 32px, var(--max-w));
  margin: 0 auto;
  padding-bottom: calc(24px + var(--safe-bottom));
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  max-width: var(--max-w);
  margin: 0 auto;
}
.site-header__title {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
}
.site-header__actions { display: flex; gap: 8px; align-items: center; }

.ad-banner {
  background: var(--surface);
  margin: 16px auto 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.ad-banner img { width: 100%; aspect-ratio: 3/1; object-fit: cover; }
.ad-placeholder {
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
  background: linear-gradient(135deg, #eef2ff, #f0fdf4);
  font-size: .9rem;
}

.qq-bar {
  margin: 16px 0;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  gap: 12px;
}
.qq-bar__label { color: var(--muted); font-size: .875rem; }
.qq-bar__number { font-size: 1.25rem; font-weight: 700; letter-spacing: .5px; }
.qq-bar__btn {
  flex-shrink: 0;
  padding: 8px 16px;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  font-size: .875rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 24px 0 12px;
  padding-left: 10px;
  border-left: 3px solid var(--primary);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 640px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
}

.product-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  color: inherit;
  transition: transform .15s, box-shadow .15s;
}
.product-card:active { transform: scale(.98); }
.product-card__img-wrap {
  aspect-ratio: 1;
  background: #f3f4f6;
  overflow: hidden;
}
.product-card__img { width: 100%; height: 100%; object-fit: cover; }
.product-card__body { padding: 10px 12px 14px; }
.product-card__title {
  font-size: .875rem;
  font-weight: 500;
  margin: 0 0 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}
.product-card__price {
  margin: 0;
  color: var(--danger);
  font-size: 1rem;
  font-weight: 700;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
  background: var(--surface);
  border-radius: var(--radius);
}

.detail-gallery {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-top: 16px;
}
.detail-gallery__main {
  position: relative;
  aspect-ratio: 1;
  background: #f3f4f6;
}
.detail-gallery__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity .2s;
}
.detail-gallery__img.is-active { opacity: 1; }
.detail-gallery__thumbs {
  display: flex;
  gap: 8px;
  padding: 10px;
  overflow-x: auto;
}
.detail-thumb {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: none;
}
.detail-thumb.is-active { border-color: var(--primary); }
.detail-thumb img { width: 100%; height: 100%; object-fit: cover; }

.detail-info {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 12px;
  box-shadow: var(--shadow);
}
.detail-info__title { font-size: 1.25rem; margin: 0 0 8px; }
.detail-info__price { font-size: 1.5rem; color: var(--danger); font-weight: 700; margin: 0 0 12px; }
.detail-info__qq { font-size: .9rem; color: var(--muted); }

.detail-content {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 12px;
  box-shadow: var(--shadow);
}

/* 宝贝详情：与后台编辑器所见即所得一致 */
.detail-content {
  padding: 24px 22px;
}
.detail-content__body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.85;
  color: #333;
  white-space: pre-wrap;
  word-break: break-word;
  letter-spacing: 0.02em;
}
.detail-content__body p {
  margin: 0 0 14px;
}
.detail-content__body div {
  margin: 0 0 10px;
}
.detail-content__body strong,
.detail-content__body b {
  font-weight: 700;
}
.detail-content__body ol,
.detail-content__body ul {
  margin: 0 0 16px;
  padding-left: 1.6em;
}
.detail-content__body li {
  margin-bottom: 10px;
  line-height: 1.85;
}
.detail-content__body span[style*="font-size"],
.detail-content__body font[size] {
  line-height: inherit;
}
.detail-content__body span[style*="color"],
.detail-content__body font[color] {
  /* 保留编辑器 inline 颜色 */
}
.detail-content__body img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 12px 0;
  display: block;
}
.detail-content__body a {
  color: var(--primary);
  text-decoration: underline;
  word-break: break-all;
}



.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  transition: background .15s;
}
.btn:hover { background: var(--primary-hover); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn--ghost { background: transparent; color: var(--primary); border: 1px solid var(--border); }
.btn--ghost:hover { background: #f3f4f6; }
.btn--danger { background: var(--danger); }
.btn--sm { padding: 6px 12px; font-size: .8125rem; }
.btn--block { width: 100%; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: .875rem;
  margin: 12px 0 0;
}

.admin-body { background: #eef1f5; }
.login-panel {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: min(100%, 380px);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px 24px;
  box-shadow: var(--shadow);
}
.login-card h1 { margin: 0 0 8px; font-size: 1.25rem; }
.login-card p { color: var(--muted); font-size: .875rem; margin: 0 0 24px; }

.admin-panel { padding: 16px; max-width: 800px; margin: 0 auto; }
.admin-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.admin-section__title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: .8125rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--muted);
}
.form-input, .form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .9375rem;
  font-family: inherit;
  background: #fff;
}
.form-textarea { min-height: 120px; resize: vertical; }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; }
.form-hint { font-size: .75rem; color: var(--muted); margin-top: 4px; }

.upload-area {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.upload-preview {
  width: 120px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f3f4f6;
}
.upload-label {
  display: inline-block;
  padding: 8px 14px;
  background: #f3f4f6;
  border-radius: 8px;
  font-size: .8125rem;
  cursor: pointer;
  border: 1px dashed var(--border);
}
.upload-label input { display: none; }

.admin-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.admin-item:last-child { border-bottom: none; }
.admin-item__thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  background: #f3f4f6;
  flex-shrink: 0;
}
.admin-item__info { flex: 1; min-width: 0; }
.admin-item__title {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-item__meta { font-size: .8125rem; color: var(--muted); }
.admin-item__actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }

.editor-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
@media (min-width: 640px) {
  .editor-overlay { align-items: center; padding: 24px; }
}
.editor-panel {
  background: var(--surface);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px 20px calc(20px + var(--safe-bottom));
}
@media (min-width: 640px) {
  .editor-panel { border-radius: var(--radius); }
}
.editor-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.editor-panel__header h2 { margin: 0; font-size: 1.125rem; }

.img-chip {
  position: relative;
  display: inline-block;
  margin: 4px;
}
.img-chip img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.img-chip button {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  line-height: 1;
}

.toast {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: .875rem;
  z-index: 300;
  max-width: 90%;
  text-align: center;
}
.toast--success { background: #059669; }
.toast--error { background: var(--danger); }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .875rem;
  cursor: pointer;
}

.site-footer {
  text-align: center;
  padding: 24px 16px;
  color: var(--muted);
  font-size: .75rem;
}

.price-usdt-inline {
  font-size: .8125rem;
  font-weight: 500;
  color: #059669;
  margin-left: 6px;
}
.detail-info__price .price-usdt-inline {
  display: block;
  margin: 6px 0 0;
  font-size: .9375rem;
}
