:root {
  --primary: #ff4d4f;
  --primary-2: #ff7a45;
  --bg: #f6f7f9;
  --text: #1f2329;
  --sub: #8a909a;
  --line: #eceef1;
  --green: #07c160;
  --blue: #1677ff;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

button { font-family: inherit; cursor: pointer; border: none; background: none; }
input { font-family: inherit; outline: none; }
.hidden { display: none !important; }

/* ---------------- 按钮 ---------------- */
.btn-primary {
  padding: 10px 22px; border-radius: 999px; color: #fff; font-size: 15px; font-weight: 600;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 4px 12px rgba(255, 77, 79, .3); transition: transform .12s, box-shadow .12s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(255, 77, 79, .4); }
.btn-primary:active { transform: translateY(0); }
.btn-primary.sm { padding: 6px 14px; font-size: 13px; }
.btn-primary.btn-block { display: block; width: 100%; }

.btn-ghost {
  padding: 10px 22px; border-radius: 999px; font-size: 15px; font-weight: 600;
  border: 1px solid var(--line); background: #fff; color: var(--text);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost.sm { padding: 6px 14px; font-size: 13px; }
.btn-ghost.btn-block { display: block; width: 100%; margin-top: 14px; }

/* ---------------- 顶栏 ---------------- */
.topbar { position: sticky; top: 0; z-index: 50; background: #fff; box-shadow: 0 1px 0 var(--line); }
.topbar-inner { display: flex; align-items: center; gap: 18px; height: 60px; }
.logo {
  font-size: 20px; font-weight: 800; white-space: nowrap; cursor: pointer;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.search-box { flex: 1; display: flex; max-width: 440px; }
.search-box input {
  flex: 1; height: 36px; border: 2px solid var(--primary); border-right: none;
  border-radius: 18px 0 0 18px; padding: 0 16px; font-size: 14px;
}
.search-box button {
  height: 36px; padding: 0 18px; border-radius: 0 18px 18px 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; font-size: 14px;
}
.nav { margin-left: auto; display: flex; gap: 2px; }
.nav-link { position: relative; padding: 8px 12px; border-radius: 8px; font-size: 14px; cursor: pointer; user-select: none; }
.nav-link:hover { background: #f2f3f5; }
.nav-link.active { color: var(--primary); font-weight: 600; }
.badge {
  position: absolute; top: -2px; right: -6px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--primary); color: #fff; font-size: 11px;
  line-height: 17px; text-align: center; font-weight: 400;
}

/* ---------------- 首页 ---------------- */
.hero {
  margin: 20px 0 4px; padding: 40px 44px; border-radius: 18px; color: #fff;
  background: linear-gradient(120deg, #ff4d4f, #ff7a45 55%, #ffa940);
  display: flex; align-items: center; justify-content: space-between; overflow: hidden;
}
.hero-text h1 { font-size: 30px; letter-spacing: 1px; }
.hero-text p { margin: 12px 0 22px; font-size: 15px; opacity: .92; }
.hero-emoji { font-size: 96px; filter: drop-shadow(0 10px 18px rgba(0,0,0,.2)); animation: float 3s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.category-bar { display: flex; gap: 10px; margin: 18px 0; flex-wrap: wrap; }
.chip {
  padding: 7px 18px; border-radius: 999px; background: #fff; border: 1px solid var(--line);
  font-size: 14px; color: var(--text); transition: all .15s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; border-color: transparent; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; padding-bottom: 36px; }
.card { background: #fff; border-radius: 14px; overflow: hidden; transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(0,0,0,.09); }
.card-img { position: relative; height: 170px; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #fff8f2, #ffeef0); cursor: pointer; }
.card-img .emoji { font-size: 72px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.12)); transition: transform .2s; }
.card:hover .card-img .emoji { transform: scale(1.08); }
.soldout {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.45); color: #fff; font-size: 15px; letter-spacing: 3px;
}
.card-body { padding: 12px 14px 14px; }
.card-name { font-size: 15px; font-weight: 600; cursor: pointer; }
.card-name:hover { color: var(--primary); }
.card-sub { margin-top: 4px; font-size: 12px; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-foot { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; }
.price { font-size: 19px; font-weight: 700; color: var(--primary); }
.sales { margin-left: 6px; font-size: 11px; color: var(--sub); font-weight: 400; }
.btn-add { padding: 6px 13px; border-radius: 999px; color: #fff; font-size: 12px; background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.btn-add:hover { opacity: .9; }
.btn-add:disabled { background: #d9dbe0; cursor: not-allowed; }

.empty { padding: 60px 0; text-align: center; color: var(--sub); font-size: 15px; }

.page-title { margin: 24px 0 16px; font-size: 22px; }

/* ---------------- 购物车 ---------------- */
.cart-list { display: flex; flex-direction: column; gap: 12px; }
.cart-row {
  display: flex; align-items: center; gap: 16px; background: #fff; border-radius: 14px; padding: 14px 18px;
}
.cart-emoji { font-size: 40px; width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #fff8f2, #ffeef0); border-radius: 12px; }
.cart-info { flex: 1; min-width: 0; }
.cart-name { font-size: 15px; font-weight: 600; }
.cart-sub { margin-top: 3px; font-size: 12px; color: var(--sub); }
.cart-price { width: 90px; font-size: 14px; color: var(--sub); }
.cart-subtotal { width: 100px; text-align: right; font-size: 16px; font-weight: 700; color: var(--primary); }
.qty-ctrl { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.qty-ctrl button { width: 30px; height: 30px; font-size: 16px; color: var(--text); background: #fff; }
.qty-ctrl button:hover { background: #f2f3f5; color: var(--primary); }
.qty-ctrl span { min-width: 36px; text-align: center; font-size: 14px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); line-height: 30px; }
.btn-del { font-size: 13px; color: var(--sub); }
.btn-del:hover { color: var(--primary); }

.cart-footer {
  position: sticky; bottom: 16px; margin-top: 16px; background: #fff; border-radius: 14px;
  padding: 16px 22px; display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
}
.cart-total { font-size: 15px; }
.cart-total b { font-size: 22px; color: var(--primary); }

/* ---------------- 结算 ---------------- */
.checkout { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; padding-bottom: 40px; }
.panel { background: #fff; border-radius: 14px; padding: 22px; }
.panel h3 { margin-bottom: 16px; font-size: 16px; }
.checkout-form label { display: block; margin-bottom: 14px; font-size: 14px; color: var(--sub); }
.checkout-form input {
  display: block; width: 100%; margin-top: 6px; height: 42px; padding: 0 14px; font-size: 14px;
  border: 1px solid var(--line); border-radius: 10px; transition: border-color .15s;
}
.checkout-form input:focus { border-color: var(--primary); }
.checkout-summary { align-self: start; }
.co-item { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 14px; border-bottom: 1px dashed var(--line); }
.co-item span:last-child { color: var(--sub); white-space: nowrap; }
.co-total { margin: 16px 0; font-size: 15px; text-align: right; }
.co-total b { font-size: 24px; color: var(--primary); }
.co-tip { margin-top: 10px; font-size: 12px; color: var(--sub); text-align: center; }

/* ---------------- 订单 ---------------- */
.order-list { display: flex; flex-direction: column; gap: 12px; padding-bottom: 40px; }
.order-card { background: #fff; border-radius: 14px; padding: 18px 22px; }
.order-head { display: flex; justify-content: space-between; align-items: center; }
.order-no { font-size: 13px; color: var(--sub); }
.status { font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.st-unpaid { color: #d46b08; background: #fff7e6; }
.st-paid { color: #389e0d; background: #f6ffed; }
.st-cancelled { color: #8a909a; background: #f2f3f5; }
.order-items { margin: 12px 0; font-size: 14px; line-height: 1.7; color: #43484e; }
.order-foot { display: flex; align-items: center; gap: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.order-time { font-size: 12px; color: var(--sub); }
.order-total { font-size: 14px; }
.order-total b { color: var(--primary); font-size: 16px; }
.order-actions { margin-left: auto; display: flex; gap: 8px; }

/* ---------------- 弹窗 ---------------- */
.mask {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { position: relative; background: #fff; border-radius: 18px; animation: popIn .2s ease; }
@keyframes popIn { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }
.modal-close { position: absolute; top: 12px; right: 14px; font-size: 16px; color: var(--sub); z-index: 2; }
.modal-close:hover { color: var(--text); }

.detail-modal { width: 720px; max-width: 100%; max-height: 86vh; overflow: auto; padding: 28px; }
.detail-modal { display: grid; grid-template-columns: 300px 1fr; gap: 26px; }
.detail-img {
  height: 300px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #fff8f2, #ffeef0);
}
.detail-img .emoji { font-size: 130px; filter: drop-shadow(0 10px 16px rgba(0,0,0,.15)); }
.detail-info h2 { font-size: 21px; }
.detail-sub { margin-top: 6px; font-size: 13px; color: var(--sub); }
.detail-price { margin-top: 14px; font-size: 30px; font-weight: 800; color: var(--primary); }
.detail-meta { margin-top: 6px; font-size: 12px; color: var(--sub); }
.detail-desc { margin-top: 14px; font-size: 14px; line-height: 1.8; color: #43484e; }
.detail-qty { margin-top: 18px; display: flex; align-items: center; gap: 14px; font-size: 14px; color: var(--sub); }
.detail-actions { margin-top: 22px; display: flex; gap: 12px; }

/* ---------------- 支付弹窗 ---------------- */
.pay-box {
  width: 360px; max-width: 100%; background: #fff; border-radius: 18px; overflow: hidden;
  animation: popIn .2s ease; text-align: center;
}
.pay-head {
  padding: 16px; color: #fff; font-size: 16px; font-weight: 700; letter-spacing: 1px;
  background: linear-gradient(135deg, #07c160, #10b95c);
}
.pay-logo { font-size: 18px; }
#payWait { padding: 24px 28px 28px; }
.pay-amount { font-size: 30px; font-weight: 800; }
.pay-order { margin-top: 4px; font-size: 12px; color: var(--sub); }
.qr-frame {
  position: relative; width: 210px; height: 210px; margin: 18px auto 14px; padding: 10px;
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
}
.qr-frame img { width: 100%; height: 100%; display: block; }
.qr-scanline {
  position: absolute; left: 10px; right: 10px; top: 10px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--green), transparent);
  box-shadow: 0 0 8px var(--green); animation: scan 2.2s linear infinite;
}
@keyframes scan { 0% { top: 10px; } 50% { top: calc(100% - 12px); } 100% { top: 10px; } }
.pay-tip { font-size: 13px; color: #43484e; }
.pay-status { margin: 10px 0 4px; font-size: 13px; color: var(--sub); display: flex; align-items: center; justify-content: center; gap: 6px; }
.pay-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: blink 1s infinite; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
#paySuccess { padding: 40px 28px 44px; }
.pay-check {
  width: 74px; height: 74px; margin: 0 auto 16px; border-radius: 50%;
  background: linear-gradient(135deg, #07c160, #10b95c); color: #fff; font-size: 40px; line-height: 74px;
  animation: popIn .35s cubic-bezier(.2, 1.6, .5, 1);
}
.pay-ok { font-size: 19px; font-weight: 700; }
#paySuccess .pay-tip { margin-top: 10px; color: var(--sub); }

/* ---------------- Toast / 页脚 ---------------- */
.toast {
  position: fixed; top: 76px; left: 50%; transform: translateX(-50%); z-index: 200;
  background: rgba(0,0,0,.78); color: #fff; font-size: 14px; padding: 10px 22px; border-radius: 999px;
  animation: fadeIn .15s ease;
}
.footer { padding: 26px 0 34px; text-align: center; font-size: 12px; color: var(--sub); }

/* ---------------- 手机收银台（pay.html） ---------------- */
.paypage { min-height: 100vh; background: linear-gradient(180deg, #eefaf2, #f6f7f9 40%); display: flex; justify-content: center; padding: 40px 16px; }
.pp-card { width: 100%; max-width: 380px; background: #fff; border-radius: 18px; padding: 28px 24px; box-shadow: 0 10px 30px rgba(0,0,0,.08); text-align: center; align-self: flex-start; }
.pp-logo { font-size: 20px; font-weight: 800; color: var(--text); }
.pp-title { margin-top: 18px; font-size: 17px; font-weight: 700; }
.pp-amount { margin-top: 14px; font-size: 34px; font-weight: 800; }
.pp-order { margin-top: 6px; font-size: 12px; color: var(--sub); }
.pp-items { margin-top: 14px; text-align: left; font-size: 13px; }
.pp-item { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.pp-btn {
  display: block; width: 100%; margin-top: 22px; height: 46px; border-radius: 999px; color: #fff;
  font-size: 16px; font-weight: 700; background: linear-gradient(135deg, #07c160, #10b95c);
}
.pp-btn:disabled { opacity: .6; }
.pp-tip { margin-top: 14px; font-size: 12px; color: var(--sub); }
.pp-success { padding: 10px 0 4px; }
.pp-check {
  width: 70px; height: 70px; margin: 6px auto 14px; border-radius: 50%; color: #fff; font-size: 38px; line-height: 70px;
  background: linear-gradient(135deg, #07c160, #10b95c); animation: popIn .35s cubic-bezier(.2, 1.6, .5, 1);
}
.pp-ok { font-size: 18px; font-weight: 700; color: #389e0d; }
.pp-err { padding: 30px 0; font-size: 15px; color: var(--sub); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 860px) {
  .checkout { grid-template-columns: 1fr; }
  .detail-modal { grid-template-columns: 1fr; width: 420px; }
  .detail-img { height: 200px; }
  .detail-img .emoji { font-size: 90px; }
  .hero { padding: 28px 24px; }
  .hero-text h1 { font-size: 23px; }
  .hero-emoji { font-size: 60px; }
}
@media (max-width: 640px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 10px 0; gap: 10px; }
  .search-box { order: 3; max-width: none; width: 100%; }
  .nav { margin-left: auto; }
  .cart-row { flex-wrap: wrap; }
  .cart-price { width: auto; }
}
