:root{
  --bg:#0b0c10;
  --card:#101218;
  --muted:#9aa3b2;
  --text:#f2f5ff;
  --line:rgba(255,255,255,.08);
  --brand:#ffffff;
  --accent:#7c88ff;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background:
    radial-gradient(1000px 600px at 20% -10%, rgba(124,136,255,.18), transparent 55%),
    radial-gradient(900px 500px at 90% 10%, rgba(124,136,255,.10), transparent 60%),
    var(--bg);
  color:var(--text);
}

a{color:inherit;text-decoration:none}

.container{
  max-width:1080px;
  margin:0 auto;
  padding:24px;
}

.muted{color:var(--muted)}
.small{font-size:13px}
.mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace
}
.break{word-break:break-all}

/* ===== Topbar ===== */
.topbar{
  position:sticky;
  top:0;
  backdrop-filter: blur(10px);
  background: rgba(11,12,16,.65);
  border-bottom:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 24px;
  z-index:20;
}
.brand{
  font-weight:700;
  letter-spacing:.3px;
}
.nav{
  display:flex;
  gap:10px;
  align-items:center;
}

/* ===== Buttons ===== */
.btn{
  border:1px solid var(--line);
  background:rgba(255,255,255,.02);
  color:var(--text);
  padding:10px 14px;
  border-radius:12px;
  cursor:pointer;
  transition:.15s;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
}
.btn:hover{
  transform:translateY(-1px);
  border-color:rgba(255,255,255,.16);
}
.btn:active{transform:translateY(0px)}

.btn-primary{
  background: linear-gradient(180deg, rgba(124,136,255,.25), rgba(124,136,255,.10));
  border-color: rgba(124,136,255,.45);
}
.btn-ghost{background:transparent}
.btn-ghost.active{border-color:rgba(124,136,255,.45)}

.badge{
  background:rgba(124,136,255,.25);
  border:1px solid rgba(124,136,255,.45);
  padding:2px 8px;
  border-radius:999px;
  font-size:12px;
  line-height:1.2;
  white-space:nowrap;
}

/* ===== Hero ===== */
.hero{
  padding:28px 0 18px 0;
}
.hero h1{
  margin:0 0 10px 0;
  font-size:34px;
  letter-spacing:-.3px;
}
.hero p{
  margin:0;
  color:var(--muted);
  max-width:720px;
  line-height:1.6;
}

/* ===== Generic product grid (used elsewhere) ===== */
.grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:16px;
  margin-top:18px;
}
@media (max-width: 900px){
  .grid{grid-template-columns:1fr;}
}
@media (max-width: 640px){
  .grid{grid-template-columns:1fr;}
}

/* ===== Card ===== */
.card{
  background:rgba(16,18,24,.8);
  border:1px solid var(--line);
  border-radius:18px;
  padding:16px;
  box-shadow: 0 8px 30px rgba(0,0,0,.22);
}

/* ===== Product card ===== */
.pcard{
  padding:0;
  overflow:hidden;
  display:flex;
  flex-direction:column;
}

.pimg{
  width:100%;
  height:260px;
  object-fit:contain;
  display:block;
  background:#0f1117;
}

.pbody{
  padding:14px 14px 16px 14px;
  display:flex;
  flex-direction:column;
  gap:10px;
  flex:1;
  min-height:0;
}

.ptitle{
  font-weight:650;
  margin:0;
  line-height:1.35;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}

/* ===== Utility row ===== */
.row-between{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:14px;
}

.link-muted{color:var(--muted)}
.link-muted:hover{color:var(--text)}
.price{
  font-size:22px;
  font-weight:700;
}

.kv{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:12px;
}

.pill{
  border:1px solid var(--line);
  padding:8px 10px;
  border-radius:999px;
  cursor:pointer;
  user-select:none;
  font-size:13px;
  background:rgba(255,255,255,.02);
}
.pill.active{
  border-color:rgba(124,136,255,.55);
  background:rgba(124,136,255,.12);
}

/* ===== Product detail page ===== */
.product{
  display:grid;
  grid-template-columns: 1.1fr .9fr;
  gap:18px;
  margin-top:14px;
}
@media (max-width: 900px){
  .product{grid-template-columns:1fr;}
}

.gallery{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}
.gallery img{
  width:100%;
  border-radius:14px;
  border:1px solid var(--line);
  object-fit:contain;
  aspect-ratio:1/1;
  background:#0f1117;
}

/* ===== Common spacing ===== */
.spacer{height:10px}
.hr{
  border-top:1px solid var(--line);
  margin:14px 0;
}

/* ===== Tables ===== */
.table{
  width:100%;
  border-collapse:collapse;
}
.table th,.table td{
  padding:10px;
  border-bottom:1px solid var(--line);
  text-align:left;
}
.table td:last-child{text-align:right}

/* ===== Inputs ===== */
.qty{
  width:64px;
  padding:8px 10px;
  border-radius:12px;
  border:1px solid var(--line);
  background:transparent;
  color:var(--text);
}

/* ===== Checkout / Pay ===== */
.checkout{margin-top:16px}
.pay-grid{
  display:grid;
  grid-template-columns:1.1fr .9fr;
  gap:16px;
  margin-top:12px;
}
@media (max-width: 900px){
  .pay-grid{grid-template-columns:1fr;}
}

.qr-wrap{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:10px;
}
.qr{
  width:260px;
  height:260px;
  border-radius:16px;
  border:1px solid var(--line);
  background:#0f1117;
}
.status{
  margin-top:10px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.02);
}

/* ===== Footer ===== */
.footer{
  border-top:1px solid var(--line);
  margin-top:28px;
}
.footer-inner{
  display:flex;
  justify-content:space-between;
  gap:14px;
  flex-wrap:wrap;
  padding:14px 0;
}

/* =========================================================
   MOBILE OPTIMIZATION
   目标：
   - 手机端顶部不拥挤
   - 商品卡片更像商城
   - 2列布局时更紧凑整齐
   ========================================================= */

@media (max-width: 900px){
  .container{
    padding:18px;
  }

  .hero{
    padding:22px 0 14px 0;
  }

  .hero h1{
    font-size:28px;
    line-height:1.15;
  }

  .hero p{
    font-size:14px;
    line-height:1.55;
  }
}

@media (max-width: 640px){
  .container{
    padding:14px;
  }

  .topbar{
    padding:12px 14px;
  }

  .brand{
    font-size:17px;
  }

  .nav{
    gap:8px;
  }

  .nav .btn{
    padding:8px 10px;
    border-radius:10px;
    font-size:13px;
    gap:6px;
  }

  .badge{
    font-size:11px;
    padding:2px 6px;
  }

  .hero{
    padding:18px 0 10px 0;
  }

  .hero h1{
    margin:0 0 8px 0;
    font-size:24px;
  }

  .hero p{
    font-size:13px;
    line-height:1.5;
  }

  /* 通用卡片在手机上更紧凑 */
  .card{
    padding:12px;
    border-radius:16px;
  }

  /* 商品详情页图库保持舒服间距 */
  .gallery{
    gap:10px;
  }
  .gallery img{
    border-radius:12px;
  }

  .price{
    font-size:18px;
  }

  .pill{
    padding:7px 10px;
    font-size:12px;
  }

  .footer{
    margin-top:20px;
  }
  .footer-inner{
    padding:12px 0;
    gap:8px;
  }
}