/* ══════════════════════════════════════════════════════════════
   软件收录模板 — 暗色卡片风
   每张卡片：图片轮播 + 价格 + 下载 + 详情
   ════════════════════════════════════════════════════════════════ */

:root {
  --bg: #0a0d14;
  --bg-soft: #111623;
  --panel: #161c2c;
  --panel-hi: #1d2537;
  --line: #263049;
  --text: #e6ebf5;
  --muted: #8a95ad;
  --accent: #4f8cff;
  --accent-hi: #6ba1ff;
  --gold: #f0b429;
  --radius: 14px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, "Segoe UI", sans-serif;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(79, 140, 255, 0.12), transparent 60%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

img { display: block; max-width: 100%; }

/* ── 区块 ───────────────────────────────────────────────── */
.section { max-width: 1200px; margin: 0 auto; padding: 40px 24px 64px; }
.section-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px 28px;
  margin-bottom: 28px;
}
.section-head h2 { font-size: 1.6rem; font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.catalog-tabs { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 280px; min-width: 0; }
.catalog-tabs button { border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--muted); padding: 7px 14px; font: inherit; font-size: 0.88rem; line-height: 1.5; cursor: pointer; max-width: 100%; overflow-wrap: anywhere; }
.catalog-tabs button:hover { color: var(--text); border-color: var(--accent); }
.catalog-tabs button[aria-pressed="true"] { background: rgba(79, 140, 255, 0.16); border-color: var(--accent); color: var(--accent-hi); }
.catalog-tabs button:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 3px; }
.catalog-section-tabs { flex-wrap: nowrap; overflow-x: auto; gap: 12px; margin: -4px -4px 16px; padding: 4px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.catalog-section-tabs::-webkit-scrollbar { height: 6px; }
.catalog-section-tabs::-webkit-scrollbar-track { background: transparent; }
.catalog-section-tabs::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
.catalog-section-tabs button { flex: 0 0 auto; max-width: none; padding: 9px 18px; font-size: 1.3rem; font-weight: 700; white-space: nowrap; }
.count-pill {
  background: var(--panel-hi);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 0.85rem;
}
.empty-hint {
  color: var(--muted);
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
}

/* ── 软件网格 ───────────────────────────────────────────── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px 24px;
  align-items: start;
}
.product-card {
  position: relative;
  height: 320px;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 44px 46px;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.product-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

/* ── 卡片图片轮播 ───────────────────────────────────────── */
.gallery {
  position: relative;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-soft);
  touch-action: pan-y pinch-zoom;
}
.gallery-stack { position: absolute; inset: 0; pointer-events: none; }
.gallery-stack-layer {
  position: absolute;
  top: 50%;
  width: auto;
  height: auto;
  max-width: 52%;
  max-height: 74%;
  object-fit: contain;
  object-position: center;
  border: 1px solid #586680;
  border-radius: 7px;
  background: var(--panel-hi);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transform: translateY(-50%);
  filter: brightness(0.85);
}
.gallery-stack-layer.layer-prev { left: 8px; }
.gallery-stack-layer.layer-next { right: 8px; }
.gallery-window {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: clip;
  background: var(--bg-soft);
}
.gallery-stacked .gallery-window { background: transparent; }
.gallery:focus-visible, .detail-gallery:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: -2px; }
.gallery-track {
  position: absolute;
  inset: 0;
  display: flex;
  height: 100%;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.gallery-slide {
  flex: 0 0 100%;
  height: 100%;
}
.gallery-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.gallery-stacked .gallery-slide { display: flex; align-items: center; justify-content: center; }
.gallery-stacked .gallery-slide img {
  width: 64%;
  height: calc(100% - 20px);
  border: 1px solid #43516d;
  border-radius: 8px;
  background: var(--bg-soft);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
}
.gallery-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
}

.gallery-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(10, 13, 20, 0.55);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s, background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gallery:hover .gallery-arrow,
.gallery:focus-within .gallery-arrow,
.detail-gallery:hover .gallery-arrow,
.detail-gallery:focus-within .gallery-arrow { opacity: 1; }
.gallery-arrow:hover { background: var(--accent); }
.gallery-arrow.left { left: 10px; }
.gallery-arrow.right { right: 10px; }

.gallery-dots {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 36%;
  display: flex;
  justify-content: center;
  gap: 7px;
  flex-wrap: wrap;
  z-index: 4;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  padding: 0;
  transition: background 0.2s, transform 0.2s;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45), 0 1px 4px rgba(0, 0, 0, 0.8);
}
.dot.active { background: #fff; transform: scale(1.35); }

.gallery-price {
  position: absolute;
  left: 6px;
  right: 18px;
  bottom: 6px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}
.gallery-price > strong {
  min-width: 0;
  padding: 0;
  background: transparent;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.gallery-price-select {
  min-width: 0;
  max-width: 45%;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  background: rgba(10, 13, 20, 0.9);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  pointer-events: auto;
}
.gallery-price-select:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
.gallery-stacked .gallery-price { right: 6px; }
.gallery-stacked .gallery-price > strong,
.gallery-stacked .gallery-price-select { max-width: 30%; }

.card-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--gold);
  color: #1a1300;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

/* ── 卡片文案 ───────────────────────────────────────────── */
.card-body { display: flex; align-items: center; gap: 8px; padding: 8px 12px; min-width: 0; overflow: hidden; }
.card-title { flex: 0 1 auto; min-width: 0; max-width: 40%; font-size: 1.15rem; font-weight: 700; line-height: 28px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-title:only-child { max-width: 100%; }
.card-desc {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 28px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.price-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 14px;
}
.price-cny { font-size: 1.4rem; color: var(--gold); font-weight: 800; }
.price-free { font-size: 1.3rem; color: var(--accent-hi); font-weight: 700; }
.price-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.price-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg-soft);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, transform 0.18s;
}
.price-option:hover { border-color: var(--accent); transform: translateY(-1px); }
.price-option.active { border-color: var(--accent); background: rgba(79, 140, 255, 0.12); }
.price-option span { color: var(--text); font-size: 0.82rem; font-weight: 700; }
.price-option strong { color: var(--gold); font-size: 1rem; line-height: 1.35; }
.detail-price-options { margin-top: 0; margin-bottom: 14px; }

.card-toolbar { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 12px 10px; }
.product-card .product-feedback { flex: 1; min-width: 0; padding: 0; }
.product-card .feedback-bar { flex-wrap: nowrap; gap: 2px; }
.product-card .feedback-button { min-width: 0; min-height: 28px; height: 28px; padding: 3px 6px; border: 0; background: transparent; white-space: nowrap; }
.product-card .feedback-button:hover, .product-card .feedback-button[aria-pressed="true"] { border: 0; background: transparent; }
.product-card .feedback-button[aria-pressed="true"] { color: var(--accent-hi); }
.product-card .feedback-button[aria-pressed="true"] svg { fill: currentColor; }
.card-toolbar .feedback-button { gap: 3px; padding-right: 3px; padding-left: 3px; }
.product-card .feedback-button span:not(:last-child) { flex-shrink: 0; }
.product-card .feedback-button span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.product-card .feedback-error {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 6;
  top: 12px;
  left: 12px;
  right: 12px;
  max-height: 52px;
  overflow-y: auto;
  margin: 0;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
  box-shadow: var(--shadow);
}
.product-card .feedback-error .feedback-text-button { flex-shrink: 0; }
.card-actions {
  display: flex;
  flex-shrink: 0;
  gap: 6px;
}
.card-actions .btn { flex: 0 0 auto; min-width: 44px; height: 32px; padding: 6px 8px; border-radius: 7px; font-size: 0.85rem; line-height: 18px; }

/* ── 按钮 ───────────────────────────────────────────────── */
.btn {
  flex: 1;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-hi));
  color: #fff;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-line {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent-hi);
}
.btn-line:hover { background: rgba(79, 140, 255, 0.12); }
.btn-ghost {
  background: var(--panel-hi);
  border-color: var(--line);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--muted); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── 在线客服（DMA 风格）────────────────────────────────── */
.chat-dock { position: fixed; right: 20px; bottom: 20px; z-index: 200; }
.chat-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 164px;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 24px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.chat-toggle:hover { background: var(--accent-hi); }
.chat-panel {
  display: none;
  flex-direction: column;
  position: fixed;
  right: 20px;
  bottom: 70px;
  width: 360px;
  max-height: 500px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.chat-panel.open { display: flex; }
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.chat-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
}
.chat-close:hover { color: var(--text); }
.chat-body { display: flex; flex-direction: column; min-height: 200px; }
.messages { flex: 1; overflow-y: auto; padding: 12px; max-height: 280px; }
.message {
  padding: 6px 10px;
  margin: 4px 0;
  border-radius: 8px;
  font-size: 0.82rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.message.user { background: rgba(79, 140, 255, 0.16); text-align: right; }
.message.assistant, .message.admin { background: var(--panel-hi); }
.message.system { color: var(--muted); text-align: center; font-size: 0.75rem; }
.chat-form {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  align-items: flex-end;
}
.chat-form textarea {
  flex: 1;
  min-width: 0;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  color: var(--text);
  font-size: 0.82rem;
  resize: none;
  font-family: inherit;
}
.chat-form textarea:focus { outline: none; border-color: var(--accent); }
.chat-form button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.82rem;
}
.chat-form button:disabled { opacity: 0.55; cursor: wait; }
.chat-img-btn { background: var(--panel-hi) !important; color: var(--text) !important; padding: 8px 10px !important; }
.chat-img { max-width: 160px; border-radius: 6px; }
.chat-file-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--panel-hi);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  max-width: 220px;
}
.chat-file-link:hover { background: rgba(79, 140, 255, 0.16); }
.chat-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.78rem; }
.msg-read-status { display: block; font-size: 10px; margin-top: 2px; text-align: right; }
.msg-read-status.read { color: var(--accent); }
.msg-read-status.unread { color: var(--muted); }
.chat-upload-progress { padding: 4px 12px; }
.chat-upload-track { height: 14px; background: rgba(255, 255, 255, 0.08); border-radius: 7px; overflow: hidden; position: relative; }
.chat-upload-track > div { height: 100%; background: var(--accent); border-radius: 7px; transition: width 0.3s; }
.chat-upload-track > span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; color: #fff; font-weight: 600; }

/* ── 页脚 ───────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 30px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}

/* ── 详情弹窗 ───────────────────────────────────────────── */
.detail-mask {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(4, 6, 11, 0.8);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.detail-modal {
  position: relative;
  width: min(760px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.detail-toolbar { position: sticky; top: 0; height: 0; z-index: 5; }
.detail-close {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(10, 13, 20, 0.6);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.detail-close:hover { background: var(--accent); }

.detail-gallery {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 70vh;
  min-height: 120px;
  touch-action: pan-y pinch-zoom;
  overflow: clip;
  background: var(--bg-soft);
  border-radius: 16px 16px 0 0;
}
.detail-track {
  position: absolute;
  inset: 0;
  display: flex;
  height: 100%;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.detail-slide { flex: 0 0 100%; height: 100%; }
.detail-slide img { width: 100%; height: 100%; object-fit: contain; }

.detail-info { padding: 24px 26px 28px; }
.detail-info h3 { font-size: 1.5rem; font-weight: 700; margin-bottom: 12px; }
.is-reviews-only .detail-info h3 { padding-right: 40px; overflow-wrap: anywhere; }
.is-reviews-only .product-reviews { margin-top: 16px; padding-top: 0; border-top: 0; }
.feature-list {
  list-style: none;
  margin: 18px 0;
  display: grid;
  gap: 8px;
}
.feature-list li {
  position: relative;
  padding-left: 22px;
  color: var(--text);
  font-size: 0.95rem;
}
.feature-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent-hi);
  font-weight: 700;
}
.detail-text { color: var(--muted); font-size: 0.96rem; }
.detail-text p { margin-bottom: 10px; }
.detail-actions { display: flex; gap: 12px; margin-top: 24px; }
.detail-actions .btn { flex: 0 0 auto; min-width: 140px; }

@media (prefers-reduced-motion: reduce) {
  .gallery-track, .detail-track, .product-card { transition: none; }
}

/* ── 响应式 ─────────────────────────────────────────────── */
@media (max-width: 720px) {
  .product-grid { grid-template-columns: 1fr; }
  .product-card { height: 304px; }
  .detail-actions { flex-direction: column; }
  .detail-actions .btn { width: 100%; }
  .chat-panel { position: fixed; inset: 0; width: 100%; max-height: 100%; border-radius: 0; right: 0; bottom: 0; }
  .chat-dock { right: 12px; bottom: 12px; }
}

@media (max-width: 420px) {
  .gallery-stacked .gallery-price > strong { font-size: 1rem; }
}

@media (max-width: 380px) {
  .card-toolbar .feedback-button span:not(:last-child) { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); }
}
