* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root { --brand: #ff6b35; --brand2: #f7931e; --ink: #222; --muted: #999; --line: #eee; }
html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
body { font-family: -apple-system, "PingFang SC", "Helvetica Neue", Arial, sans-serif; background: #f4f5f7; color: var(--ink); }
svg { display: block; }
img { max-width: 100%; }
a { cursor: pointer; }
.brand-logo { display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 3px 8px rgba(0,0,0,.12); }
.brand-logo svg { display: block; }

/* ============ 顶部导航 (PC默认显示) ============ */
.topnav { background: #fff; box-shadow: 0 1px 8px rgba(0,0,0,.05); position: sticky; top: 0; z-index: 30; }
.topnav-inner { max-width: 1180px; margin: 0 auto; height: 62px; display: flex; align-items: center; padding: 0 24px; }
.logo-area { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.logo-badge { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; }
.logo-badge svg { border-radius: 9px; box-shadow: 0 2px 6px rgba(255,87,34,.3); }
.logo-text { font-size: 19px; font-weight: 700; }
.nav-links { display: flex; gap: 28px; margin-left: 48px; flex: 1; }
.nav-links a { color: #555; font-size: 15px; text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
.nav-links a.active, .nav-links a:hover { color: var(--brand); border-color: var(--brand); }
.nav-user { font-size: 14px; color: #555; display: flex; align-items: center; gap: 12px; }
.nav-user .login-link { color: var(--brand); font-weight: 600; }
.nav-user .logout-link { color: #aaa; }

/* ============ 主体容器 ============ */
.container { max-width: 1180px; margin: 0 auto; padding: 20px 24px 40px; min-height: 60vh; }

/* Hero */
.hero { background: linear-gradient(135deg, var(--brand), var(--brand2)); border-radius: 16px; padding: 30px 28px; color: #fff; margin-bottom: 22px; }
.hero-text h1 { font-size: 26px; }
.hero-text p { font-size: 14px; opacity: .92; margin-top: 8px; }
.search { margin-top: 20px; background: #fff; border-radius: 26px; padding: 6px 6px 6px 18px; display: flex; align-items: center; gap: 10px; max-width: 560px; }
.search svg { width: 18px; height: 18px; color: var(--brand); }
.search input { border: none; outline: none; flex: 1; font-size: 15px; color: #222; }
.search button { border: none; background: linear-gradient(135deg,var(--brand),var(--brand2)); color: #fff; border-radius: 22px; padding: 10px 24px; font-size: 14px; font-weight: 600; cursor: pointer; }

/* 分类 */
.cats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.cats.scroll { flex-wrap: nowrap; overflow-x: auto; }
.cat { background: #fff; border-radius: 20px; padding: 8px 16px; font-size: 14px; color: #555; white-space: nowrap; border: 1px solid transparent; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.cat svg { width: 17px; height: 17px; }
.cat.active { background: #fff3ec; color: var(--brand); border-color: var(--brand); font-weight: 600; }

/* 商品网格 */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.card { background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 1px 8px rgba(0,0,0,.05); cursor: pointer; transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-3px); box-shadow: 0 6px 18px rgba(0,0,0,.1); }
.card .cover { height: 140px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg,#fafbfc,#eef1f5); }
.card .info { padding: 12px 14px 14px; }
.card .title { font-size: 15px; font-weight: 600; line-height: 1.3; height: 40px; overflow: hidden; }
.card .sub { font-size: 12px; color: var(--muted); margin: 4px 0 8px; }
.card .price { color: #ff4d2e; font-weight: 700; font-size: 18px; }
.card .price small { font-size: 12px; }
.card .origin { color: #bbb; font-size: 12px; text-decoration: line-through; margin-left: 5px; }
.card .sales { float: right; font-size: 12px; color: var(--muted); margin-top: 6px; }
.empty { text-align: center; color: #aaa; padding: 50px; font-size: 14px; grid-column: 1 / -1; }

/* ============ 页脚 ============ */
.footer { background: #2b2f3a; color: #c9ccd6; margin-top: 30px; }
.footer-inner { max-width: 1180px; margin: 0 auto; padding: 36px 24px 24px; }
.footer-cols { display: flex; gap: 60px; flex-wrap: wrap; }
.footer-col h4 { color: #fff; font-size: 15px; margin-bottom: 14px; }
.footer-col a, .footer-col p { display: block; color: #9da1ad; font-size: 13px; line-height: 2; text-decoration: none; }
.footer-col a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid #3a3f4d; margin-top: 26px; padding-top: 18px; text-align: center; font-size: 12px; color: #888; display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.footer-bottom a { color: #888; text-decoration: none; }
.footer-bottom a:hover { color: #bbb; }

/* ============ 底部 Tab (默认隐藏, H5显示) ============ */
.tabbar { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); z-index: 40; }
.tabbar a { flex: 1; text-align: center; padding: 7px 0; font-size: 11px; color: var(--muted); text-decoration: none; }
.tabbar a.on { color: var(--brand); }
.tabbar .ico { display: block; width: 22px; height: 22px; margin: 0 auto 2px; }

/* ============ 弹层通用 ============ */
.mask { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: none; align-items: center; justify-content: center; z-index: 60; padding: 20px; }
.mask.show { display: flex; }
.dialog { background: #fff; border-radius: 16px; width: 100%; max-width: 460px; max-height: 86vh; overflow: auto; padding: 26px; position: relative; }
.dialog h3 { font-size: 19px; margin-bottom: 6px; }
.dialog-sub { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.dialog-close { position: absolute; top: 14px; right: 16px; background: none; border: none; font-size: 26px; color: #bbb; cursor: pointer; line-height: 1; }
.dialog-tip { font-size: 12px; color: #aaa; text-align: center; margin-top: 14px; }
.dialog-tip a { color: var(--brand); }
.login-logo { display: flex; justify-content: center; margin-bottom: 12px; }
.login-logo svg { border-radius: 16px; box-shadow: 0 6px 16px rgba(255,87,34,.3); }
.login-dialog { text-align: center; }
.login-dialog .input-row { text-align: left; }

/* 登录弹层 */
.input-row { display: flex; align-items: center; border: 1px solid var(--line); background: #fafafa; border-radius: 10px; padding: 0 14px; margin-bottom: 14px; }
.input-row .pre { color: var(--muted); font-size: 14px; padding-right: 10px; border-right: 1px solid #e5e5e5; margin-right: 12px; }
.input-row input { flex: 1; border: none; outline: none; background: transparent; padding: 13px 0; font-size: 15px; }
.input-row .code-btn { color: var(--brand); font-size: 13px; white-space: nowrap; padding-left: 12px; cursor: pointer; }
.input-row .code-btn.disabled { color: #bbb; cursor: default; }
.btn-primary { width: 100%; border: none; border-radius: 24px; padding: 13px; font-size: 16px; font-weight: 600; color: #fff; background: linear-gradient(135deg,var(--brand),var(--brand2)); cursor: pointer; }
.btn-sec { width: 100%; border: none; border-radius: 24px; padding: 13px; font-size: 15px; color: #555; background: #f0f0f0; margin-top: 10px; cursor: pointer; }

/* 商品详情 */
.detail-head { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; }
.detail-head .meta h3 { font-size: 18px; }
.detail-head .meta .sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.detail-price { color: #ff4d2e; font-size: 24px; font-weight: 700; }
.detail-price .origin { color: #bbb; font-size: 14px; text-decoration: line-through; margin-left: 8px; }
.detail-desc { font-size: 14px; color: #666; line-height: 1.7; margin: 14px 0; white-space: pre-wrap; }
.detail-row { display: flex; justify-content: space-between; font-size: 13px; color: #888; padding: 6px 0; }

/* 收银台 */
.checkout-product { display: flex; gap: 12px; align-items: center; padding: 14px; background: #fafbfc; border-radius: 12px; margin-bottom: 16px; }
.checkout-product .ci { flex: 1; }
.checkout-product .ci .t { font-size: 14px; font-weight: 600; }
.checkout-product .ci .p { color: #ff4d2e; font-weight: 700; margin-top: 6px; }
.field-label { font-size: 13px; color: #666; margin: 12px 0 6px; }
.field { display: block; width: 100%; border: 1px solid var(--line); background: #fafafa; border-radius: 10px; padding: 12px; font-size: 14px; outline: none; }
.qty { display: flex; align-items: center; gap: 0; }
.qty button { width: 38px; height: 38px; border: 1px solid var(--line); background: #fafafa; font-size: 18px; cursor: pointer; }
.qty button:first-child { border-radius: 9px 0 0 9px; }
.qty button:last-child { border-radius: 0 9px 9px 0; }
.qty input { width: 56px; height: 38px; text-align: center; border: 1px solid var(--line); border-left: none; border-right: none; font-size: 15px; outline: none; }
.pay-methods { display: flex; gap: 10px; margin-top: 6px; }
.pay-method { flex: 1; border: 1.5px solid var(--line); border-radius: 10px; padding: 12px; text-align: center; font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; }
.pay-method.sel { border-color: var(--brand); background: #fff3ec; color: var(--brand); font-weight: 600; }
.pay-method .dot { width: 18px; height: 18px; border-radius: 50%; }
.checkout-total { display: flex; justify-content: space-between; align-items: center; margin: 18px 0; font-size: 15px; }
.checkout-total b { color: #ff4d2e; font-size: 22px; }
.success-box { text-align: center; padding: 10px 0; }
.success-box .ok { width: 64px; height: 64px; margin: 0 auto 12px; }
.card-code { background: #fff7f0; border: 1px dashed var(--brand); border-radius: 10px; padding: 14px; margin: 14px 0; font-size: 18px; font-weight: 700; letter-spacing: 2px; color: var(--brand); }

/* 订单列表 */
.orders-box { margin-top: 8px; }
.order-item { border: 1px solid #f0f0f0; border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.order-item .oh { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.order-item .oh .t { flex: 1; font-size: 14px; font-weight: 600; }
.order-item .badge { font-size: 12px; padding: 3px 9px; border-radius: 10px; }
.b0 { background:#fff7e6;color:#fa8c16; } .b1 { background:#e6f7ff;color:#1890ff; }
.b2 { background:#f6ffed;color:#52c41a; } .b3 { background:#f5f5f5;color:#999; } .b4 { background:#fff1f0;color:#ff4d4f; }
.order-item .orow { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: #777; padding: 3px 0; }
.order-item .orow span:last-child, .order-item .orow b { text-align: right; word-break: break-all; }
.order-item .orow b { color: #222; }
.order-item .oact { margin-top: 10px; display: flex; gap: 10px; justify-content: flex-end; }
.mini-btn { padding: 6px 14px; border-radius: 16px; font-size: 13px; border: none; cursor: pointer; }
.mini-btn.pri { background: linear-gradient(135deg,var(--brand),var(--brand2)); color: #fff; }
.mini-btn.ghost { background: #f0f0f0; color: #555; }

/* 单页内容 */
.page-content { font-size: 14px; color: #555; line-height: 1.9; white-space: pre-wrap; margin-top: 10px; }

/* 个人中心 */
.profile-head { text-align: center; padding: 16px 0; }
.profile-head .avatar { width: 64px; height: 64px; border-radius: 50%; background: linear-gradient(135deg,var(--brand),var(--brand2)); margin: 0 auto 10px; display: flex; align-items: center; justify-content: center; }
.profile-head .avatar svg { width: 34px; height: 34px; }
.profile-head .pphone { font-size: 16px; font-weight: 600; }
.profile-menu a { display: flex; justify-content: space-between; padding: 14px 4px; border-bottom: 1px solid #f3f3f3; font-size: 14px; color: #444; text-decoration: none; }
.profile-menu a:last-child { border: none; }

/* Toast */
.toast { position: fixed; top: 30%; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.82); color: #fff; padding: 11px 20px; border-radius: 8px; font-size: 14px; z-index: 99; display: none; max-width: 80%; text-align: center; }

/* ============ 响应式: H5 (<=768px) ============ */
@media (max-width: 768px) {
  .topnav { display: none; }
  .footer { display: none; }
  .tabbar { display: flex; }
  .container { padding: 10px 12px 76px; width: 100%; }
  .hero { border-radius: 12px; padding: 18px 16px; margin-bottom: 14px; }
  .hero-text h1 { font-size: 20px; }
  .hero-text p { font-size: 12px; line-height: 1.5; }
  /* 搜索框: 不再用固定 max-width, 自适应宽度防溢出 */
  .search { margin-top: 14px; max-width: none; width: 100%; padding: 5px 5px 5px 14px; }
  .search input { min-width: 0; }
  .search button { padding: 9px 16px; font-size: 13px; flex: 0 0 auto; }
  /* 分类横向滚动: 两侧留白, 末尾补白, 隐藏滚动条 */
  .cats { flex-wrap: nowrap; overflow-x: auto; gap: 8px; margin: 0 -12px 14px; padding: 2px 12px 4px; -webkit-overflow-scrolling: touch; }
  .cats::-webkit-scrollbar { display: none; }
  .cat { padding: 7px 13px; font-size: 13px; }
  /* 商品两列 */
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card { min-width: 0; }
  .card:hover { transform: none; box-shadow: 0 1px 8px rgba(0,0,0,.05); }
  .card .cover { height: 116px; }
  .card .title { font-size: 14px; height: 37px; }
  .card .info { padding: 9px 10px 11px; }
  .card .price { font-size: 16px; }
  /* 弹层: 底部抽屉式, 适配安全区 */
  .mask { align-items: flex-end; padding: 0; }
  .dialog { border-radius: 16px 16px 0 0; max-width: 100%; width: 100%; align-self: flex-end; max-height: 88vh; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); }
  .coupon-overlay { padding: 16px; }
  .coupon-modal { max-width: 100%; }
  /* 底部 Tab 适配 iPhone 安全区 */
  .tabbar { padding-bottom: env(safe-area-inset-bottom); }
}

/* ============ 优惠券领取弹窗 (炫酷动画) ============ */
.coupon-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: none; align-items: center; justify-content: center; z-index: 80; padding: 20px; }
.coupon-overlay.show { display: flex; animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.coupon-modal { position: relative; width: 100%; max-width: 360px; background: linear-gradient(170deg, #ff5e3a, #ff8d3a 55%, #ffb74d); border-radius: 22px; padding: 28px 22px 22px; text-align: center; box-shadow: 0 20px 60px rgba(255,80,40,.45); animation: popIn .5s cubic-bezier(.18,.89,.32,1.28); overflow: hidden; }
@keyframes popIn { 0% { transform: scale(.5) translateY(40px); opacity: 0; } 100% { transform: scale(1) translateY(0); opacity: 1; } }
/* 旋转光芒背景 */
.coupon-rays { position: absolute; top: -40%; left: 50%; width: 200%; height: 200%; transform: translateX(-50%); background: repeating-conic-gradient(from 0deg, rgba(255,255,255,.14) 0deg 12deg, transparent 12deg 24deg); animation: spin 14s linear infinite; pointer-events: none; }
@keyframes spin { to { transform: translateX(-50%) rotate(360deg); } }
.coupon-close { position: absolute; top: 12px; right: 14px; background: rgba(255,255,255,.25); color: #fff; border: none; width: 28px; height: 28px; border-radius: 50%; font-size: 18px; cursor: pointer; z-index: 3; }
.coupon-header { position: relative; z-index: 2; color: #fff; margin-bottom: 16px; }
.coupon-crown { font-size: 46px; animation: bob 2s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-6px) rotate(4deg); } }
.coupon-header h2 { font-size: 23px; margin-top: 6px; text-shadow: 0 2px 6px rgba(180,40,0,.4); letter-spacing: 1px; }
.coupon-header p { font-size: 13px; opacity: .95; margin-top: 4px; }
.coupon-list { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.coupon-ticket { display: flex; align-items: center; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 12px rgba(180,40,0,.2); animation: slideUp .5s ease backwards; }
.coupon-ticket:nth-child(1) { animation-delay: .15s; }
.coupon-ticket:nth-child(2) { animation-delay: .28s; }
.coupon-ticket:nth-child(3) { animation-delay: .41s; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.coupon-ticket .amt { background: linear-gradient(135deg,#ff5e3a,#ff8d3a); color: #fff; padding: 14px 16px; min-width: 92px; position: relative; }
.coupon-ticket .amt::after { content: ''; position: absolute; right: -6px; top: 0; bottom: 0; width: 12px; background-image: radial-gradient(circle 4px at right, transparent 60%, #fff 62%); background-size: 12px 12px; }
.coupon-ticket .amt .big { font-size: 26px; font-weight: 800; }
.coupon-ticket .amt .big small { font-size: 14px; }
.coupon-ticket .amt .cond { font-size: 11px; opacity: .9; margin-top: 2px; }
.coupon-ticket .meta { flex: 1; text-align: left; padding: 0 14px; }
.coupon-ticket .meta .nm { font-size: 14px; font-weight: 600; color: #333; }
.coupon-ticket .meta .vd { font-size: 11px; color: #999; margin-top: 3px; }
.coupon-claim-btn { position: relative; z-index: 2; width: 80%; border: none; border-radius: 26px; padding: 14px; font-size: 17px; font-weight: 700; color: #ff4d2e; background: linear-gradient(180deg,#fff8e6,#ffe7b3); box-shadow: 0 6px 16px rgba(150,30,0,.3); cursor: pointer; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
.coupon-claim-btn:disabled { opacity: .7; animation: none; cursor: default; }
.coupon-foot { position: relative; z-index: 2; color: rgba(255,255,255,.9); font-size: 11px; margin-top: 12px; }
.coupon-empty { color: #fff; padding: 20px; }

/* 我的优惠券列表 */
.uc-item { display: flex; align-items: center; border: 1px solid #f0f0f0; border-radius: 12px; overflow: hidden; margin-bottom: 10px; }
.uc-item .amt { background: linear-gradient(135deg,#ff6b35,#f7931e); color: #fff; padding: 14px 18px; min-width: 90px; text-align: center; }
.uc-item.used .amt, .uc-item.expired .amt { background: #ccc; }
.uc-item .amt .b { font-size: 22px; font-weight: 800; }
.uc-item .meta { flex: 1; min-width: 0; padding: 0 14px; }
.uc-item .meta .nm { font-size: 14px; font-weight: 600; }
.uc-item .meta .vd { font-size: 11px; color: #999; margin-top: 3px; }
.uc-item .st { font-size: 12px; padding-right: 14px; color: #52c41a; }
.uc-item.used .st, .uc-item.expired .st { color: #999; }

/* ============ 收银台优惠券选择 ============ */
.coupon-select { display: flex; justify-content: space-between; align-items: center; padding: 13px 0; border-top: 1px solid #f3f3f3; margin-top: 8px; font-size: 14px; color: #555; cursor: pointer; }
.coupon-select .cs-val { color: #999; }
.coupon-select .cs-val.on { color: #ff4d2e; font-weight: 600; }
.checkout-total { display: block; margin: 16px 0; }
.checkout-total .ct-lines { font-size: 13px; color: #888; }
.checkout-total .ct-line { display: flex; justify-content: space-between; padding: 3px 0; }
.checkout-total .ct-final { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 15px; }
.checkout-total .ct-final b { color: #ff4d2e; font-size: 22px; }

/* 优惠券选择器列表 */
.pick-coupon { display: flex; align-items: center; gap: 12px; border: 1px solid #f0f0f0; border-radius: 12px; padding: 12px; margin-bottom: 10px; cursor: pointer; position: relative; }
.pick-coupon.sel { border-color: #ff6b35; background: #fff7f2; }
.pick-coupon.disabled { opacity: .45; cursor: not-allowed; }
.pick-coupon .pc-amt { color: #ff4d2e; font-size: 20px; font-weight: 800; min-width: 70px; }
.pick-coupon .pc-meta .pc-nm { font-size: 14px; font-weight: 600; }
.pick-coupon .pc-meta .pc-cond { font-size: 12px; color: #999; margin-top: 3px; }
.pick-coupon .pc-check { position: absolute; right: 14px; color: #ff6b35; font-weight: 700; }

/* 优惠券类型标签 */
.ctag { display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: 8px; background: #fff0e6; color: #ff6b35; margin-left: 4px; vertical-align: middle; font-weight: 500; }
