:root {
  --primary: #1f5fd0;
  --primary-dark: #164aa6;
  --accent: #f59e0b;
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #dc2626;
  --radius: 10px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }
.container { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* 顶栏 */
.topbar { background: var(--primary-dark); color: #cbd5e1; font-size: 13px; }
.topbar .container { display: flex; justify-content: space-between; align-items: center; height: 34px; }
.topbar a { color: #fff; margin-left: 14px; }

/* 导航 */
header.nav { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.06); position: sticky; top: 0; z-index: 100; }
.nav-inner { display: flex; align-items: center; height: 68px; gap: 40px; }
.logo { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; color: var(--primary); }
.logo .mark { width: 40px; height: 40px; border-radius: 9px; background: linear-gradient(135deg, #2b6de8, #164aa6); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 20px; }
nav.menu { display: flex; gap: 4px; flex: 1; }
nav.menu a { padding: 8px 16px; border-radius: 8px; color: #374151; font-weight: 500; }
nav.menu a:hover, nav.menu a.active { color: var(--primary); background: #eef3fd; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: none; cursor: pointer; border-radius: 8px; padding: 9px 20px; font-size: 14px; font-weight: 500; transition: .15s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { border: 1px solid var(--border); background: #fff; color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.cart-btn { position: relative; padding: 9px 14px; }
.cart-badge { position: absolute; top: -6px; right: -6px; background: var(--danger); color: #fff; font-size: 11px; min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }

/* 横幅 */
.hero { background: linear-gradient(120deg, #123d8f 0%, #1f5fd0 55%, #2b7ff2 100%); color: #fff; padding: 64px 0; }
.hero h1 { font-size: 38px; margin-bottom: 14px; }
.hero p { font-size: 17px; opacity: .92; max-width: 640px; margin-bottom: 28px; }
.hero .stats { display: flex; gap: 48px; margin-top: 36px; }
.hero .stats b { font-size: 26px; display: block; }
.hero .stats span { font-size: 13px; opacity: .85; }

/* 通用区块 */
section.block { padding: 48px 0; }
.sec-head { text-align: center; margin-bottom: 30px; }
.sec-head h2 { font-size: 26px; margin-bottom: 8px; }
.sec-head p { color: var(--muted); }
.card { background: var(--card); border-radius: var(--radius); box-shadow: 0 1px 4px rgba(0,0,0,.05); }

/* 分类筛选 */
.cat-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.cat-bar button { border: 1px solid var(--border); background: #fff; padding: 8px 18px; border-radius: 20px; cursor: pointer; font-size: 14px; color: #374151; }
.cat-bar button.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* 商品 */
.grid-products { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.p-card { background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.05); transition: .18s; cursor: pointer; display: flex; flex-direction: column; }
.p-card:hover { transform: translateY(-4px); box-shadow: 0 8px 20px rgba(31,95,208,.12); }
.p-thumb { height: 120px; display: flex; align-items: center; justify-content: center; font-size: 46px; background: linear-gradient(135deg, #eef3fd, #dbe8fb); position: relative; }
.p-tag { position: absolute; top: 10px; left: 10px; background: var(--danger); color: #fff; font-size: 12px; padding: 2px 10px; border-radius: 12px; }
.p-body { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; }
.p-name { font-size: 15px; font-weight: 600; line-height: 1.45; margin-bottom: 4px; min-height: 44px; }
.p-cat { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.p-foot { display: flex; align-items: baseline; justify-content: space-between; margin-top: auto; }
.p-price { color: var(--danger); font-size: 19px; font-weight: 700; }
.p-price small { font-size: 12px; }
.p-orig { color: #9ca3af; font-size: 12px; text-decoration: line-through; margin-left: 6px; }
.p-sales { color: var(--muted); font-size: 12px; }
.p-add { margin-top: 10px; width: 100%; padding: 8px; }

/* 新闻 */
.news-list { display: flex; flex-direction: column; gap: 14px; }
.news-item { background: #fff; border-radius: var(--radius); padding: 20px 24px; box-shadow: 0 1px 4px rgba(0,0,0,.05); cursor: pointer; transition: .15s; }
.news-item:hover { box-shadow: 0 6px 16px rgba(0,0,0,.09); }
.news-item h3 { font-size: 17px; margin-bottom: 6px; color: #111827; }
.news-item .meta { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.news-item p { color: #4b5563; font-size: 14px; }

/* 页脚 */
footer { background: #1a2333; color: #94a3b8; margin-top: 40px; }
.footer-main { display: grid; grid-template-columns: 2fr 1fr 1fr 1.4fr; gap: 30px; padding: 44px 0 30px; }
.footer-main h4 { color: #fff; font-size: 15px; margin-bottom: 14px; }
.footer-main li { list-style: none; margin-bottom: 9px; font-size: 13.5px; }
.footer-main a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid #2c3850; padding: 18px 0; text-align: center; font-size: 13px; }
.footer-bottom a { color: #94a3b8; margin: 0 6px; }
.footer-bottom a:hover { color: #fff; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: none; align-items: center; justify-content: center; z-index: 200; padding: 16px; }
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 14px; max-width: 680px; width: 100%; max-height: 86vh; overflow-y: auto; padding: 28px 30px; position: relative; }
.modal .close { position: absolute; top: 14px; right: 18px; font-size: 22px; color: #9ca3af; cursor: pointer; background: none; border: none; }
.modal h3 { font-size: 20px; margin-bottom: 4px; padding-right: 30px; }
.modal .m-cat { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.modal .m-price { color: var(--danger); font-size: 24px; font-weight: 700; margin: 12px 0; }
.modal .m-desc { color: #4b5563; background: #f8fafc; border-radius: 8px; padding: 14px 16px; margin-bottom: 16px; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-item label { display: block; font-size: 14px; margin-bottom: 6px; color: #374151; }
.form-item input, .form-item select, .form-item textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; }
.form-item input:focus, .form-item select:focus { outline: none; border-color: var(--primary); }
.form-item.full { grid-column: 1 / -1; }

/* 购物车/结算布局 */
.page-title { font-size: 24px; margin: 30px 0 20px; }
.cart-table { width: 100%; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.cart-table th, .cart-table td { padding: 14px 16px; text-align: left; font-size: 14px; }
.cart-table th { background: #f8fafc; color: #6b7280; font-weight: 500; }
.cart-table td { border-top: 1px solid var(--border); vertical-align: middle; }
.qty-btn { width: 26px; height: 26px; border: 1px solid var(--border); background: #fff; cursor: pointer; border-radius: 6px; }
.qty-num { width: 40px; text-align: center; display: inline-block; }
.cart-bar { position: sticky; bottom: 0; background: #fff; border-radius: var(--radius); box-shadow: 0 -2px 12px rgba(0,0,0,.08); padding: 14px 20px; display: flex; justify-content: flex-end; align-items: center; gap: 20px; margin-top: 16px; }
.total-price { color: var(--danger); font-size: 22px; font-weight: 700; }

/* 支付页 */
.pay-layout { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; align-items: start; }
.pay-methods { background: #fff; border-radius: var(--radius); padding: 22px 24px; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.pay-method { display: flex; align-items: center; gap: 12px; border: 1.5px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; cursor: pointer; }
.pay-method.active { border-color: var(--primary); background: #eef3fd; }
.pay-method .icon { font-size: 26px; }
.pay-qr { text-align: center; }
.pay-qr canvas, .pay-qr img { border: 1px solid var(--border); border-radius: 8px; }
.order-items { background: #fff; border-radius: var(--radius); padding: 22px 24px; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.order-items h3 { margin-bottom: 14px; }
.oi-row { display: flex; justify-content: space-between; font-size: 14px; padding: 7px 0; color: #4b5563; }
.oi-row.total { border-top: 1px dashed var(--border); margin-top: 8px; padding-top: 14px; font-size: 17px; font-weight: 700; color: var(--text); }
.oi-row.total span:last-child { color: var(--danger); }

/* 成功页 */
.success-box { max-width: 560px; margin: 60px auto; background: #fff; border-radius: 14px; padding: 50px 40px; text-align: center; box-shadow: 0 1px 6px rgba(0,0,0,.06); }
.success-box .ok { width: 72px; height: 72px; border-radius: 50%; background: #dcfce7; color: #16a34a; font-size: 36px; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; }

/* 特色条 */
.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.feature { background: #fff; border-radius: var(--radius); padding: 26px 22px; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.feature .fi { font-size: 34px; margin-bottom: 12px; }
.feature h3 { font-size: 17px; margin-bottom: 8px; }
.feature p { font-size: 13.5px; color: var(--muted); }

.toast { position: fixed; top: 80px; left: 50%; transform: translateX(-50%); background: rgba(15,23,42,.88); color: #fff; padding: 10px 24px; border-radius: 24px; font-size: 14px; z-index: 300; display: none; }

@media (max-width: 900px) {
  .grid-products, .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-main { grid-template-columns: 1fr 1fr; }
  .pay-layout { grid-template-columns: 1fr; }
  nav.menu { overflow-x: auto; }
  .hero h1 { font-size: 28px; }
}
@media (max-width: 560px) {
  .grid-products, .feature-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .footer-main { grid-template-columns: 1fr; }
}
