:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1e222b;
  --border: #2a2f3a;
  --text: #e8eaed;
  --muted: #9aa1ac;
  --accent: #4f8cff;
  --accent-hover: #3d7bf0;
  --success: #35c88a;
  --warn: #f0a04b;
  --danger: #e5544b;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(0, 0, 0, .28);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #f1f3f6;
    --border: #e2e5ea;
    --text: #1b1f27;
    --muted: #666e7a;
    --shadow: 0 4px 18px rgba(15, 20, 30, .08);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.65 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* header / footer */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 10;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.brand { font-weight: 700; font-size: 18px; color: var(--text); }
.site-header nav a { margin-left: 20px; color: var(--muted); font-size: 14px; }
.site-header nav a:hover { color: var(--text); }
.site-footer {
  margin-top: 72px; padding: 40px 0 24px; border-top: 1px solid var(--border);
  color: var(--muted); font-size: 13px;
  background: var(--surface);
}
.site-footer p { margin: 0; }

.footer-main {
  display: flex; justify-content: space-between; align-items: flex-start;
  flex-wrap: wrap; gap: 32px 48px;
}
.footer-brand { max-width: 380px; }
.footer-brand .brand { display: inline-block; margin-bottom: 8px; }
.footer-desc { color: var(--muted); font-size: 13px; line-height: 1.7; }

.footer-nav { display: flex; gap: 48px; flex-wrap: wrap; }
.footer-col { display: flex; flex-direction: column; gap: 8px; }
.footer-col h3 {
  margin: 0 0 2px; font-size: 12px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--text); opacity: .7;
}
.footer-col a { color: var(--muted); font-size: 13px; }
.footer-col a:hover { color: var(--text); }

.disclaimer {
  margin-top: 32px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted); font-size: 12.5px; line-height: 1.7;
}
.disclaimer::before { content: "⚠ "; color: var(--warn); }

.footer-bottom {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 8px 16px;
  margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border);
}
.footer-copy { color: var(--muted); font-size: 12.5px; opacity: .85; }

@media (max-width: 640px) {
  .footer-main { gap: 28px; }
  .footer-nav { gap: 32px; }
}

main { padding-top: 32px; }

/* hero + search */
.hero { padding: 24px 0 8px; }
.hero h1 { font-size: 30px; margin: 0 0 8px; letter-spacing: -.4px; }
.hero p { color: var(--muted); margin: 0; }
.search { display: flex; gap: 10px; margin: 24px 0 8px; }
.search input {
  flex: 1; padding: 11px 14px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* grid + cards */
.section-title { margin: 36px 0 14px; font-size: 16px; color: var(--muted); font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent); }
.card-media {
  aspect-ratio: 16 / 9; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-media .placeholder { font-size: 40px; opacity: .35; }
.card-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-body h3 { margin: 0; font-size: 16px; }
.card-body p { margin: 0; color: var(--muted); font-size: 13px; flex: 1; }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }

.price { font-size: 18px; font-weight: 700; color: var(--text); }
.price .cur { font-size: 13px; margin-right: 1px; }
.price.free { color: var(--success); }
.price-old { color: var(--muted); text-decoration: line-through; font-size: 13px; margin-left: 6px; font-weight: 400; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.badge.ok { color: var(--success); border-color: color-mix(in srgb, var(--success) 40%, transparent); }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.badge.err { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background .15s ease;
}
.btn:hover { background: var(--accent-hover); color: #fff; }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* detail page */
.detail { display: grid; grid-template-columns: 1.6fr 1fr; gap: 36px; align-items: start; }
@media (max-width: 860px) { .detail { grid-template-columns: 1fr; } }

.media-wrap { position: relative; }
.media-main {
  width: 100%; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface-2); overflow: hidden;
}
.media-main img, .media-main video { width: 100%; display: block; }
.media-main img { cursor: zoom-in; }

/* hover magnifier (taobao style) */
.zoom-lens {
  position: absolute; pointer-events: none;
  border: 1px solid var(--accent);
  background: rgba(79, 140, 255, .18);
  border-radius: 4px;
}
.zoom-pane {
  position: absolute; top: 0; left: 100%; margin-left: 14px; z-index: 30;
  border: 1px solid var(--border); border-radius: var(--radius);
  background-color: var(--surface); background-repeat: no-repeat;
  box-shadow: var(--shadow); pointer-events: none;
}
.thumbs { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.thumbs img {
  width: 84px; height: 56px; object-fit: cover; border-radius: 8px; cursor: pointer;
  border: 2px solid transparent; background: var(--surface-2);
}
.thumbs img.active, .thumbs img:hover { border-color: var(--accent); }

.buy-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; position: sticky; top: 84px;
}
.buy-box h1 { margin: 0 0 6px; font-size: 22px; }
.buy-box .price-row { margin: 16px 0; font-size: 28px; }
.meta-list { list-style: none; padding: 0; margin: 16px 0; font-size: 13px; color: var(--muted); }
.meta-list li { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.meta-list li:last-child { border-bottom: 0; }

.providers { display: flex; gap: 10px; margin: 14px 0; }
.provider {
  flex: 1; position: relative; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; text-align: center; cursor: pointer; background: var(--surface-2); font-size: 14px;
}
.provider input { position: absolute; opacity: 0; }
.provider:has(input:checked) { border-color: var(--accent); color: var(--accent); }

input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
  width: 100%; padding: 10px 12px; border-radius: 10px; font: inherit;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
textarea { resize: vertical; min-height: 120px; font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 13px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.prose { line-height: 1.8; }
.prose h2 { font-size: 19px; margin: 28px 0 10px; }
.prose h3 { font-size: 16px; margin: 22px 0 8px; }
.prose img { max-width: 100%; border-radius: 8px; }
.prose code {
  background: var(--surface-2); padding: 2px 6px; border-radius: 5px;
  font-family: ui-monospace, Consolas, monospace; font-size: 13px;
}
.prose pre { background: var(--surface-2); padding: 14px; border-radius: 10px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose table { width: 100%; border-collapse: collapse; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }

/* pay page */
.pay-wrap { max-width: 480px; margin: 20px auto; text-align: center; }
.qr-box {
  background: #fff; padding: 16px; border-radius: var(--radius); display: inline-block; margin: 20px 0;
  box-shadow: var(--shadow);
}
.qr-box img { display: block; width: 240px; height: 240px; }
.pay-status { margin-top: 16px; font-size: 14px; color: var(--muted); }
.spinner {
  width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.paid-banner {
  background: color-mix(in srgb, var(--success) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--success) 40%, transparent);
  color: var(--success); padding: 16px; border-radius: var(--radius); margin: 20px 0;
}

/* tables */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; padding: 11px 12px; color: var(--muted); font-weight: 600; font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:hover td { background: var(--surface-2); }
.table .thumb { width: 56px; height: 36px; object-fit: cover; border-radius: 6px; }
code.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--muted); }

/* admin */
.admin-bar {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 18px; display: flex; gap: 18px; align-items: center; margin-bottom: 26px;
}
.admin-bar a { color: var(--muted); font-size: 14px; }
.admin-bar a.active, .admin-bar a:hover { color: var(--text); }
.admin-bar .spacer { flex: 1; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px;
}
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 4px; }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 700px) { .row { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 14px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

.gallery-edit { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.gallery-edit label { position: relative; cursor: pointer; }
.gallery-edit img { width: 100px; height: 66px; object-fit: cover; border-radius: 8px; display: block; }
.gallery-edit input { position: absolute; top: 4px; right: 4px; }

.login-wrap { max-width: 380px; margin: 8vh auto; }
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-size: 14px; }
.flash.err { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.flash.ok { background: color-mix(in srgb, var(--success) 12%, transparent); color: var(--success); }

.empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty .icon { font-size: 46px; margin-bottom: 12px; opacity: .5; }

.error-page { text-align: center; padding: 90px 20px; }
.error-page .code { font-size: 64px; font-weight: 700; color: var(--muted); }

/* nav 用户区 */
.nav-user {
  margin-left: 20px; font-size: 14px; color: var(--text); font-weight: 600;
  max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: inline-block; vertical-align: bottom;
}
.site-header nav a.nav-cta {
  background: var(--accent); color: #fff; padding: 6px 14px; border-radius: 8px;
}
.site-header nav a.nav-cta:hover { background: var(--accent-hover); color: #fff; }

/* 认证页 */
.auth-wrap { max-width: 420px; margin: 6vh auto 0; }
.auth-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 30px; box-shadow: var(--shadow);
}
.auth-head { display: flex; align-items: center; gap: 10px; }
.auth-head .logo {
  width: 34px; height: 34px; border-radius: 9px; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.auth-head h1 { margin: 0; font-size: 20px; }
.auth-sub { text-align: center; color: var(--muted); font-size: 13px; margin: 12px 0 22px; }

.code-row { display: flex; gap: 10px; }
.code-row input { flex: 1; }
.code-row .btn { white-space: nowrap; }

.auth-foot { text-align: center; font-size: 13px; color: var(--muted); margin: 16px 0 0; }
.auth-msg { font-size: 13px; margin: 8px 0 0; }
.auth-msg.ok { color: var(--success); }
.auth-msg.err { color: var(--danger); }

/* 用户中心 */
.tabs { display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; }
.tabs a {
  padding: 8px 16px; border-radius: 999px; font-size: 14px;
  border: 1px solid var(--border); color: var(--muted); background: var(--surface);
}
.tabs a.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.owned-badge { color: var(--success); font-weight: 600; }

/* 拖拽上传 */
.dropzone {
  display: block; position: relative; cursor: default;
  border: 1.5px dashed var(--border); border-radius: var(--radius);
  background: var(--surface-2); padding: 22px 18px; text-align: center;
  transition: border-color .15s ease, background .15s ease;
}
.dropzone:hover { border-color: var(--accent); }
.dropzone.dragging {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-2));
}
.dz-pick {
  border: 0; background: none; padding: 0; font: inherit; cursor: pointer;
  color: var(--accent); font-weight: 600; text-decoration: underline;
  text-underline-offset: 2px;
}
.dz-pick:hover { color: var(--accent-hover); }
.dropzone:focus { outline: none; }
.dropzone.paste-active {
  border-color: var(--accent);
  border-style: solid;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.dropzone.paste-active::after {
  content: "Ctrl+V 粘贴到这里";
  position: absolute; top: 8px; right: 10px;
  font-size: 11px; color: var(--accent); opacity: .85;
}
@keyframes dz-flash {
  from { background: color-mix(in srgb, var(--success) 28%, var(--surface-2)); }
  to { background: var(--surface-2); }
}
.dropzone.pasted { animation: dz-flash .6s ease-out; }

.dropzone kbd {
  font: inherit; font-size: 11px; padding: 1px 5px; border-radius: 4px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.dropzone .dz-icon { font-size: 24px; opacity: .6; }
.dropzone .dz-text { font-size: 13px; color: var(--muted); margin-top: 6px; }
.dropzone .dz-text strong { color: var(--accent); font-weight: 600; }
.dz-files { margin-top: 10px; font-size: 13px; text-align: left; }
.dz-files:empty { display: none; }
.dz-file {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 10px; border-radius: 8px; background: var(--surface); margin-top: 6px;
  border: 1px solid var(--border);
}
.dz-file .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-file .size { color: var(--muted); font-size: 12px; white-space: nowrap; }
.dz-preview { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.dz-preview img { width: 72px; height: 48px; object-fit: cover; border-radius: 6px; }
.dz-progress {
  height: 4px; border-radius: 999px; background: var(--surface-2);
  overflow: hidden; margin-top: 14px; display: none;
}
.dz-progress.on { display: block; }
.dz-progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* 留言板 */
.msg-list { display: flex; flex-direction: column; gap: 12px; }
.msg-item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; color: var(--text); transition: border-color .15s ease, transform .15s ease;
}
.msg-item:hover { border-color: var(--accent); transform: translateY(-2px); color: var(--text); }
.msg-main { min-width: 0; flex: 1; }
.msg-title { font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.msg-excerpt {
  color: var(--muted); font-size: 13px; margin: 0 0 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.msg-meta { display: flex; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.msg-body { white-space: pre-wrap; word-break: break-word; margin: 16px 0 0; line-height: 1.75; }

.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 26px; }

.reply-list { display: flex; flex-direction: column; gap: 12px; }
.reply {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
}
.reply-admin {
  border-color: color-mix(in srgb, var(--success) 45%, transparent);
  background: color-mix(in srgb, var(--success) 6%, var(--surface));
}
.reply-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 14px; }
.reply-body { white-space: pre-wrap; word-break: break-word; margin: 0; font-size: 14px; line-height: 1.7; }

/* 客服浮窗 */
.support { position: fixed; right: 22px; bottom: 22px; z-index: 50; }
.support-btn {
  display: flex; align-items: center; gap: 6px; padding: 11px 20px;
  border: 0; border-radius: 999px; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 600;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
}
.support-btn:hover { background: var(--accent-hover); }
.support-panel {
  position: absolute; right: 0; bottom: 56px; width: 210px; padding: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow); text-align: center;
}
.support-panel img { width: 100%; border-radius: 8px; display: block; background: #fff; }
.support-panel p { margin: 10px 0 0; font-size: 12px; color: var(--muted); }
@media (max-width: 600px) { .support { right: 14px; bottom: 14px; } }
