/* ============================================================
   软件商城 - 前台样式（响应式，PC + 手机）
   ============================================================ */
:root {
    --brand: #2563eb;
    --brand-dark: #1d4ed8;
    --brand-soft: #eff4ff;
    --accent: #f97316;
    --text: #1f2937;
    --text-2: #6b7280;
    --line: #e6e8ee;
    --bg: #f5f6f9;
    --card: #ffffff;
    --radius: 14px;
    --shadow: 0 2px 10px rgba(17, 24, 39, .06);
    --shadow-up: 0 12px 30px rgba(17, 24, 39, .14);
    --header-h: 60px;
}
[data-theme="green"]  { --brand:#0f9d6e; --brand-dark:#0b7d58; --brand-soft:#e9f8f2; --accent:#f59e0b; }
[data-theme="purple"] { --brand:#7c3aed; --brand-dark:#6228c7; --brand-soft:#f4eefe; --accent:#ec4899; }
[data-theme="dark"]   { --brand:#3b82f6; --brand-dark:#2563eb; --brand-soft:#1c2333; --accent:#f97316;
                        --text:#e7e9ee; --text-2:#9aa3b2; --line:#2a3040; --bg:#12151d; --card:#1a1f2b;
                        --shadow:0 2px 10px rgba(0,0,0,.4); --shadow-up:0 12px 30px rgba(0,0,0,.55); }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background: var(--bg); color: var(--text);
    -webkit-text-size-adjust: 100%;
    font-size: 15px; line-height: 1.65;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.sr { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }

/* ---------- 顶栏 ---------- */
.hdr {
    position: sticky; top: 0; z-index: 60;
    background: rgba(255,255,255,.92); backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
}
[data-theme="dark"] .hdr { background: rgba(26,31,43,.92); }
.hdr-in { display: flex; align-items: center; gap: 12px; height: var(--header-h); }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 17px; letter-spacing: .3px; }
.logo-mark {
    width: 30px; height: 30px; border-radius: 9px; flex: 0 0 30px;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 800;
}
.logo-txt { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hdr-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav-btn {
    border: 0; background: transparent; color: var(--text-2);
    padding: 7px 12px; border-radius: 9px; font-size: 14px; font-weight: 600;
    transition: .16s;
}
.nav-btn:hover { background: var(--brand-soft); color: var(--brand); }
.nav-btn.on { background: var(--brand-soft); color: var(--brand); }
.nav-cta {
    border: 0; background: var(--brand); color: #fff !important;
    padding: 8px 15px; border-radius: 999px; font-size: 14px; font-weight: 700;
    box-shadow: 0 4px 12px rgba(37,99,235,.28);
}
.nav-cta:hover { background: var(--brand-dark); }

/* ---------- 视图切换 ---------- */
.main { padding: 18px 0 96px; }
.view { display: none; animation: fadeUp .28s ease both; }
.view.on { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- 返回条 ---------- */
.backbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.back-btn {
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid var(--line); background: var(--card); color: var(--text);
    padding: 7px 14px 7px 11px; border-radius: 999px; font-size: 14px; font-weight: 600;
    box-shadow: var(--shadow); transition: .16s;
}
.back-btn:hover { border-color: var(--brand); color: var(--brand); transform: translateX(-2px); }
.back-btn svg { width: 15px; height: 15px; }
.crumb { color: var(--text-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb b { color: var(--text); font-weight: 600; }

/* ---------- Hero ---------- */
.hero {
    border-radius: var(--radius); padding: 26px 24px; margin-bottom: 20px;
    background: linear-gradient(120deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #fff; position: relative; overflow: hidden; box-shadow: var(--shadow);
}
.hero::after {
    content:""; position:absolute; right:-60px; top:-70px;
    width:230px; height:230px; border-radius:50%; background:rgba(255,255,255,.13);
}
.hero::before {
    content:""; position:absolute; right:70px; bottom:-100px;
    width:190px; height:190px; border-radius:50%; background:rgba(255,255,255,.09);
}
.hero h1 { margin: 0 0 8px; font-size: 24px; line-height: 1.35; font-weight: 800; position: relative; }
.hero p { margin: 0; font-size: 14px; opacity: .94; max-width: 640px; position: relative; }
.hero-acts { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; position: relative; }
.hero-btn {
    border: 0; background: #fff; color: var(--brand-dark);
    padding: 9px 18px; border-radius: 999px; font-weight: 700; font-size: 14px; transition: .16s;
}
.hero-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(0,0,0,.18); }
.hero-btn.ghost { background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.4); }

/* ---------- 公告 ---------- */
.notice {
    display: flex; gap: 9px; align-items: flex-start;
    background: #fff8ec; border: 1px solid #fde3b0; color: #8a5a10;
    border-radius: 12px; padding: 11px 14px; font-size: 13.5px; margin-bottom: 20px;
}
[data-theme="dark"] .notice { background:#2a2313; border-color:#4a3d1c; color:#f0c987; }
.notice .ic { flex: 0 0 auto; line-height: 1.5; }

/* ---------- 分区标题 ---------- */
.sec-hd { display: flex; align-items: baseline; gap: 10px; margin: 6px 0 14px; }
.sec-hd h2 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: .3px; }
.sec-hd .sub { color: var(--text-2); font-size: 13px; }
.sec-hd .more { margin-left: auto; color: var(--brand); font-size: 13px; font-weight: 600; background:none; border:0; padding:4px 6px; }

/* ---------- 分类卡 ---------- */
.cat-grid { display: grid; gap: 14px; grid-template-columns: repeat(3, minmax(0,1fr)); margin-bottom: 26px; }
.cat-card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 18px; box-shadow: var(--shadow); transition: .2s; text-align: left; width: 100%;
    display: flex; gap: 13px; align-items: flex-start;
}
.cat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-up); border-color: var(--brand); }
.cat-ico {
    width: 44px; height: 44px; flex: 0 0 44px; border-radius: 12px;
    background: var(--brand-soft); display: flex; align-items: center; justify-content: center;
    font-size: 22px;
}
.cat-body { min-width: 0; flex: 1; }
.cat-name { font-size: 16px; font-weight: 700; margin-bottom: 3px; }
.cat-desc { color: var(--text-2); font-size: 12.5px; line-height: 1.55;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cat-count { margin-top: 8px; font-size: 12px; color: var(--brand); font-weight: 600; }

/* ---------- 商品卡 ---------- */
.prod-grid { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0,1fr)); }
.prod-card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    overflow: hidden; box-shadow: var(--shadow); transition: .2s; text-align: left; width: 100%; padding: 0;
}
.prod-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-up); border-color: var(--brand); }
.pc-cover { display: block; position: relative; width: 100%; aspect-ratio: 4/3; background: var(--brand-soft); overflow: hidden; }
.pc-cover img { width: 100%; height: 100%; object-fit: cover; transition: .35s; }
.prod-card:hover .pc-cover img { transform: scale(1.05); }
.pc-ph {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 6px; color: var(--brand);
}
.pc-ph .em { font-size: 30px; opacity: .55; }
.pc-ph .tx { font-size: 12px; opacity: .7; padding: 0 10px; text-align: center; }
.pc-badge {
    position: absolute; left: 9px; top: 9px; background: var(--accent); color: #fff;
    font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
    box-shadow: 0 3px 8px rgba(0,0,0,.18);
}
.pc-cat {
    position: absolute; right: 9px; top: 9px; background: rgba(0,0,0,.5); color: #fff;
    font-size: 11px; padding: 3px 8px; border-radius: 999px; backdrop-filter: blur(4px);
}
.pc-body { display: block; padding: 12px 13px 14px; }
.pc-name {
    font-size: 15px; font-weight: 700; line-height: 1.4; margin-bottom: 5px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    min-height: 2.8em;
}
.pc-sum {
    color: var(--text-2); font-size: 12.5px; line-height: 1.5; margin-bottom: 9px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    min-height: 2.5em;
}
.pc-specs { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 11px; }
.tag {
    background: var(--brand-soft); color: var(--brand); font-size: 11.5px;
    padding: 2px 8px; border-radius: 6px; font-weight: 600;
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pc-price { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.p-now { color: #ef4444; font-size: 20px; font-weight: 800; line-height: 1; }
.p-now .cur { font-size: 13px; margin-right: 1px; }
.p-unit { color: var(--text-2); font-size: 11.5px; }
.p-old { color: #a1a1aa; font-size: 12px; text-decoration: line-through; }
.p-free { color:#0f9d6e; font-size:18px; font-weight:800; line-height:1; }

.empty {
    text-align: center; padding: 52px 20px; color: var(--text-2);
    background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius);
}
.empty .em { font-size: 38px; opacity: .5; margin-bottom: 8px; }
.empty .t { font-weight: 700; color: var(--text); margin-bottom: 4px; font-size: 15px; }

/* ---------- 详情页 ---------- */
.dt { display: grid; grid-template-columns: 400px minmax(0,1fr); gap: 24px; align-items: start; }
.dt-media {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    overflow: hidden; box-shadow: var(--shadow); position: sticky; top: calc(var(--header-h) + 16px);
}
.dt-cover { width: 100%; aspect-ratio: 1/1; background: var(--brand-soft); position: relative; }
.dt-cover img { width: 100%; height: 100%; object-fit: contain; }
.dt-info {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow);
}
.dt-cat {
    display: inline-block; background: var(--brand-soft); color: var(--brand);
    font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; margin-bottom: 10px;
}
.dt-name { margin: 0 0 8px; font-size: 23px; font-weight: 800; line-height: 1.35; }
.dt-sum { color: var(--text-2); font-size: 14px; margin: 0 0 16px; }
.dt-pricebox {
    background: linear-gradient(120deg, #fff5f0, #fff9f5);
    border: 1px solid #ffe0cc; border-radius: 12px; padding: 13px 16px; margin-bottom: 16px;
    display: flex; flex-direction: column; align-items: stretch; gap: 11px;
}
[data-theme="dark"] .dt-pricebox { background:#2a1c14; border-color:#4a3020; }
.dt-price { color: #ef4444; font-size: 30px; font-weight: 800; line-height: 1; }
.dt-price .cur { font-size: 17px; }
.dt-unit { color: var(--text-2); font-size: 13px; }
.dt-old { color: #a1a1aa; text-decoration: line-through; font-size: 14px; }
.dt-note { flex-basis: 100%; color: var(--text-2); font-size: 12.5px; line-height: 1.5; }
.dt-price-main { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
/* 价格方案选择按钮组 */
.price-opts { display: flex; gap: 9px; flex-wrap: wrap; }
.price-opt {
    border: 1.5px solid var(--line); background: var(--card); border-radius: 10px;
    padding: 8px 14px; text-align: left; transition: .16s; min-width: 92px; flex: 1 1 auto;
    display: flex; flex-direction: column; gap: 3px;
}
.price-opt:hover { border-color: var(--accent); }
.price-opt.on { border-color: var(--accent); background: #fff4ec; box-shadow: 0 0 0 2px rgba(249,115,22,.14); }
[data-theme="dark"] .price-opt.on { background: #33211a; }
.price-opt .po-name { font-size: 13px; font-weight: 700; color: var(--text); }
.price-opt .po-price { font-size: 15px; font-weight: 800; color: #ef4444; }
.price-opt .po-price i { font-style: normal; font-size: 11.5px; color: var(--text-2); font-weight: 600; margin-left: 2px; }
.price-opt.on .po-name { color: var(--accent); }
.dt-buy {
    width: 100%; border: 0; border-radius: 12px; padding: 14px;
    background: linear-gradient(120deg, var(--accent), #ea580c); color: #fff;
    font-size: 16px; font-weight: 800; letter-spacing: 1px;
    box-shadow: 0 6px 16px rgba(249,115,22,.3); transition: .18s;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.dt-buy:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(249,115,22,.38); }
.dt-buy svg { width: 19px; height: 19px; }
.dt-tip { text-align: center; color: var(--text-2); font-size: 12.5px; margin-top: 9px; }

.spec-table { width: 100%; border-collapse: collapse; margin-top: 4px; }
.spec-table th, .spec-table td {
    border: 1px solid var(--line); padding: 9px 12px; font-size: 13.5px; text-align: left; vertical-align: top;
}
.spec-table th { background: var(--bg); color: var(--text-2); font-weight: 600; width: 33%; }
.spec-table td { color: var(--text); }

.block {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow); margin-top: 18px;
}
.block h3 {
    margin: 0 0 14px; font-size: 16px; font-weight: 800;
    padding-left: 10px; border-left: 4px solid var(--brand); line-height: 1.2;
}
.dt-text { white-space: pre-wrap; word-break: break-word; font-size: 14.5px; color: var(--text); margin-bottom: 14px; }
.dt-text:last-child { margin-bottom: 0; }
.dt-img { border-radius: 10px; overflow: hidden; margin-bottom: 14px; border: 1px solid var(--line); }
.dt-img:last-child { margin-bottom: 0; }
.dt-img img { width: 100%; }
.dt-imgcap { text-align:center; color: var(--text-2); font-size: 12.5px; padding: 7px; background: var(--bg); }

/* 详情内推荐 */
.rel-list { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0,1fr)); }

/* ---------- 微信客服弹窗 ---------- */
.mask {
    position: fixed; inset: 0; background: rgba(10,12,20,.6); z-index: 200;
    display: none; align-items: center; justify-content: center; padding: 18px;
    backdrop-filter: blur(3px);
}
.mask.on { display: flex; animation: fadeIn .2s ease both; }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.modal {
    background: var(--card); border-radius: 18px; width: 100%; max-width: 400px;
    padding: 22px; box-shadow: 0 24px 60px rgba(0,0,0,.35); position: relative;
    animation: popIn .26s cubic-bezier(.2,1.2,.4,1) both; max-height: 92vh; overflow-y: auto;
}
@keyframes popIn { from{opacity:0; transform:scale(.9) translateY(14px)} to{opacity:1; transform:none} }
.modal-x {
    position: absolute; right: 12px; top: 12px; width: 30px; height: 30px; border-radius: 50%;
    border: 0; background: var(--bg); color: var(--text-2); font-size: 17px; line-height: 1;
    display: flex; align-items: center; justify-content: center; transition: .16s;
}
.modal-x:hover { background: #fee2e2; color: #dc2626; }
.m-title { font-size: 17px; font-weight: 800; margin: 0 0 4px; padding-right: 30px; }
.m-sub { color: var(--text-2); font-size: 13px; margin: 0 0 14px; }
.m-prod {
    display: flex; gap: 10px; align-items: center; background: var(--bg);
    border-radius: 11px; padding: 9px; margin-bottom: 14px;
}
.m-prod img, .m-prod .ph {
    width: 46px; height: 46px; border-radius: 8px; object-fit: cover; flex: 0 0 46px;
    background: var(--brand-soft); display:flex; align-items:center; justify-content:center; font-size:20px;
}
.m-prod .nm { font-size: 13.5px; font-weight: 700; line-height: 1.4; }
.m-prod .pr { color: #ef4444; font-weight: 800; font-size: 14px; }
.m-qr { text-align: center; margin-bottom: 12px; }
.m-qr img {
    width: 208px; height: 208px; margin: 0 auto; border-radius: 12px;
    border: 1px solid var(--line); object-fit: contain; background: #fff; padding: 6px;
}
.m-qr .noqr {
    width: 208px; height: 208px; margin: 0 auto; border-radius: 12px; border: 1px dashed var(--line);
    display: flex; align-items: center; justify-content: center; color: var(--text-2); font-size: 13px; padding: 14px;
}
.m-wxid {
    display: flex; gap: 8px; align-items: center; background: var(--bg);
    border-radius: 10px; padding: 9px 11px; margin-bottom: 10px;
}
.m-wxid .lb { color: var(--text-2); font-size: 12.5px; flex: 0 0 auto; }
.m-wxid .vv { font-weight: 700; font-size: 14.5px; letter-spacing: .4px; overflow: hidden; text-overflow: ellipsis; }
.m-copy {
    margin-left: auto; border: 1px solid var(--brand); background: var(--brand-soft); color: var(--brand);
    border-radius: 8px; padding: 5px 11px; font-size: 12.5px; font-weight: 700; flex: 0 0 auto; transition: .16s;
}
.m-copy:hover { background: var(--brand); color: #fff; }
.m-tip { color: var(--text-2); font-size: 12.5px; text-align: center; line-height: 1.6; }
.m-steps { margin: 12px 0 0; padding: 0; list-style: none; }
.m-steps li {
    display: flex; gap: 8px; font-size: 12.8px; color: var(--text-2); padding: 4px 0;
}
.m-steps .n {
    flex: 0 0 17px; height: 17px; border-radius: 50%; background: var(--brand); color: #fff;
    font-size: 10.5px; display: flex; align-items: center; justify-content: center; font-weight: 700; margin-top: 2px;
}

/* ---------- Toast ---------- */
#toast {
    position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%) translateY(20px);
    background: rgba(17,24,39,.93); color: #fff; padding: 10px 18px; border-radius: 999px;
    font-size: 13.5px; z-index: 400; opacity: 0; pointer-events: none; transition: .26s; max-width: 86vw;
    text-align: center;
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 悬浮客服 ---------- */
.fab {
    position: fixed; right: 16px; bottom: 22px; z-index: 90;
    width: 52px; height: 52px; border-radius: 50%; border: 0;
    background: linear-gradient(135deg, #22c55e, #16a34a); color: #fff;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 22px rgba(22,163,74,.42); transition: .2s;
}
.fab:hover { transform: scale(1.07); }
.fab svg { width: 25px; height: 25px; }
.fab-tx {
    position: absolute; right: 62px; top: 50%; transform: translateY(-50%);
    background: rgba(17,24,39,.9); color: #fff; font-size: 12.5px; padding: 5px 10px;
    border-radius: 7px; white-space: nowrap; opacity: 0; pointer-events: none; transition: .2s;
}
.fab:hover .fab-tx { opacity: 1; }

/* ---------- 页脚 ---------- */
.ftr { border-top: 1px solid var(--line); padding: 22px 0 28px; color: var(--text-2); font-size: 13px; }
.ftr-in { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.ftr a { color: var(--brand); font-weight: 600; }

/* ---------- 回到顶部 ---------- */
.totop {
    position: fixed; right: 18px; bottom: 86px; z-index: 89; width: 40px; height: 40px;
    border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--text-2);
    display: none; align-items: center; justify-content: center; box-shadow: var(--shadow); font-size: 17px;
}
.totop.on { display: flex; }
.totop:hover { color: var(--brand); border-color: var(--brand); }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1024px) {
    .prod-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .rel-list  { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .dt { grid-template-columns: 320px minmax(0,1fr); gap: 18px; }
}
@media (max-width: 820px) {
    .dt { grid-template-columns: 1fr; }
    .dt-media { position: static; }
    .dt-cover { aspect-ratio: 4/3; }
}
@media (max-width: 720px) {
    body { font-size: 14.5px; }
    :root { --header-h: 54px; }
    .logo-txt { font-size: 15.5px; }
    .nav-btn { padding: 6px 9px; font-size: 13px; }
    .hero { padding: 20px 18px; border-radius: 12px; }
    .hero h1 { font-size: 19px; }
    .hero p { font-size: 13px; }
    .cat-grid { grid-template-columns: 1fr; gap: 11px; }
    .prod-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 11px; }
    .rel-list { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 11px; }
    .pc-name { font-size: 14px; min-height: 2.8em; }
    .p-now { font-size: 17px; }
    .dt-name { font-size: 19px; }
    .dt-info, .block { padding: 15px; }
    .dt-price { font-size: 25px; }
    .sec-hd h2 { font-size: 16.5px; }
    .main { padding: 14px 0 88px; }
    .m-qr img, .m-qr .noqr { width: 178px; height: 178px; }
    .modal { padding: 18px; border-radius: 15px; }
    .ftr-in { flex-direction: column; align-items: flex-start; gap: 6px; }
}
@media (max-width: 380px) {
    .prod-grid { grid-template-columns: 1fr; }
    .rel-list { grid-template-columns: 1fr; }
}
