* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: clip; }
body { font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: #f6f7f9; color: #222; line-height: 1.6; display: flex; flex-direction: column; min-height: 100vh; }
a { color: #4f46e5; text-decoration: none; }
a:hover { opacity: .85; }
.container { max-width: 900px; margin: 0 auto; padding: 0; }
.narrow { max-width: 900px; }
h1 { font-size: 24px; margin: 24px 0 16px; }
h2 { font-size: 18px; margin: 20px 0 10px; }

/* 头部 */
@font-face {
  font-family: 'KuibenKai';
  src: url('/fonts/kuiben-logo.woff2') format('woff2');
  font-display: swap;
}
.site-header { background: #fff url('/textures/he-wu.png') repeat; border-bottom: 1px solid #e8e8e8; width: 100%; max-width: 900px; margin: 0 auto; box-sizing: border-box; position: sticky; top: 0; z-index: 10; height: 56px; }
.header-inner { display: flex; align-items: center; gap: 20px; padding-left: 16px; justify-content: space-between; position: relative; height: 56px; }
.logo { font-size: 25px; font-weight: 700; color: #222; letter-spacing: .5px; display: flex; align-items: center; padding: 0; font-family: 'KuibenKai', 'KaiTi', 'STKaiti', 'Kaiti SC', '楷体', serif; }
.search { display: flex; width: 100%; }
.search input { flex: 1; border: 1px solid #ddd; border-radius: 6px 0 0 6px; padding: 8px 12px; font-size: 16px; outline: none; min-width: 0; }
.search button { border: 0; background: #4f46e5; color: #fff; border-radius: 0 6px 6px 0; padding: 8px 16px; cursor: pointer; font-size: 15px; }
.search-page { max-width: none; margin: 16px 0 4px; }
/* 首页 hero */
.search-hero { padding: 36px 0 10px; text-align: center; }
.hero-mark { width: 64px; height: auto; color: #4f46e5; display: block; margin: 0 auto 14px; }
.hero-sub { margin: 0 0 18px; font-size: 15px; color: #222; letter-spacing: 2px; }
.search-hero-form { width: 100%; border-radius: 999px; overflow: hidden; background: #fff; border: 1px solid #e5e7eb; box-shadow: 0 8px 24px rgba(79,70,229,.12); }
.search-hero-form input { border: none; padding: 13px 20px; font-size: 16px; background: transparent; }
.search-hero-form button { border: 0; background: #4f46e5; color: #fff; border-radius: 0; padding: 13px 26px; cursor: pointer; font-size: 15px; letter-spacing: 2px; transition: background .2s; }
.search-hero-form button:hover { background: #4338ca; }
main { flex: 1 0 auto; width: 100%; }
.site-footer { flex-shrink: 0; }
/* 购买流程 */
.howto { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 26px 0 10px; }
.howto-step { background: #fff; border: 1px solid #ececec; border-radius: 12px; padding: 18px 16px; box-shadow: 0 2px 10px rgba(0,0,0,.04); transition: transform .2s, box-shadow .2s; }
.howto-step:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(0,0,0,.08); }
.howto-step b { font-size: 15px; color: #222; }
.howto-step p { font-size: 13px; color: #666; margin-top: 6px; line-height: 1.6; }
.howto-num { display: none; }
.howto-ic { width: 44px; height: 44px; border-radius: 12px; background: #4f46e5; color: #fff; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; box-shadow: 0 4px 10px rgba(79,70,229,.25); }
/* 页脚 */
.site-footer { background: #fff; border-top: 1px solid #e8e8e8; color: #888; margin-top: 26px; padding: 20px 0; }
.footer-main { font-size: 13px; color: #888; }
.footer-notice { font-size: 12px; color: #999; margin-top: 6px; line-height: 1.6; }
.cart-link { font-size: 15px; font-weight: 600; color: #fff; background: #d33; display: flex; align-items: center; padding: 0 22px; margin-left: 0; flex-shrink: 0; position: absolute; right: 0; top: 0; bottom: 0; }

/* 卡片网格 */
.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 20px 0; }
.card { background: #fff; border: 1px solid #ececec; border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 6px; transition: box-shadow .2s; }
.card:hover { box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.card-cover { display: block; border-radius: 6px; overflow: hidden; background: #f0f1f4; position: relative; }
.card-cover img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.cover-title { position: absolute; left: 14px; top: 14px; width: 30px; max-height: 78%; overflow: hidden; padding: 4px 0; text-align: center; font-size: 16px; font-weight: 600; color: #333; background: #fff; box-shadow: 0 0 0 2px #625242, 0 0 0 4px #fff, 0 0 0 5px #625242; writing-mode: vertical-rl; text-orientation: upright; letter-spacing: 2px; line-height: 1.15; white-space: nowrap; display: none; align-items: center; justify-content: flex-start; }
img.cover-fallback + .cover-title { display: flex; }
.detail-cover { position: relative; }
.card-title { font-size: 13px; font-weight: 600; color: #222; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; padding: 0 2px; }
.card-author { font-size: 13px; color: #666; }
.card-meta { font-size: 12px; color: #999; display: flex; gap: 10px; flex-wrap: wrap; }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.price { color: #d33; font-weight: 700; font-size: 16px; }

/* 详情页 */
.detail-main { display: grid; grid-template-columns: 200px 1fr; gap: 24px; margin: 20px 0 0; align-items: start; }
@media (max-width: 900px) { .detail-main { grid-template-columns: 1fr; } }
.detail-cover img { width: 200px; max-width: 100%; border: 1px solid #e3e3e3; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.detail-info h1 { font-size: 26px; margin: 0 0 8px; }
.detail-author { color: #555; margin-bottom: 6px; }
.detail-meta { color: #777; font-size: 14px; display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.info-list { font-size: 14px; max-width: 560px; margin: 10px 0; }
.info-row { display: flex; padding: 6px 0; border-bottom: 1px dashed #eee; }
.info-row b { width: 90px; flex-shrink: 0; color: #555; font-weight: 600; }
.info-row span { color: #333; }
.email-wrap { position: relative; }
.email-suggest { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid #e3e3e3; border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,.12); list-style: none; margin: 4px 0 0; padding: 4px 0; z-index: 20; max-height: 260px; overflow-y: auto; }
.email-suggest li { padding: 8px 12px; cursor: pointer; font-size: 14px; color: #333; }
.email-suggest li:hover, .email-suggest li.on { background: #f0f4ff; color: #4f46e5; }
/* 支付弹窗 */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 100; }
.pay-modal { background: #fff; border-radius: 12px; padding: 24px 28px; max-width: 380px; width: 90%; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.pay-modal-head { display: flex; justify-content: space-between; align-items: center; font-size: 16px; margin-bottom: 10px; }
.modal-close { border: none; background: none; font-size: 22px; color: #999; cursor: pointer; line-height: 1; padding: 0 4px; }
.modal-close:hover { color: #333; }
.pay-modal .qrcode { margin: 14px auto; width: 220px; height: 220px; }
.pay-modal .qrcode img, .pay-modal .qrcode canvas { max-width: 100%; height: auto; }
.pay-modal .pay-state { color: #4f46e5; font-weight: 600; }
.detail-desc { margin-top: 16px; }
.detail-desc p { margin: 6px 0; color: #444; font-size: 15px; }
.buy-box { background: none; border: none; padding: 14px 0; position: static; text-align: left; margin: 0; display: flex; align-items: center; justify-content: flex-start; gap: 16px; flex-wrap: wrap; }
.price-big { font-size: 24px; color: #d33; font-weight: 700; }
.buy-box .tip { text-align: left; margin: 0; }
.tip { font-size: 13px; color: #888; margin: 8px 0; }
.crumb { font-size: 13px; color: #888; margin: 16px 0; }
.empty { text-align: center; color: #999; padding: 60px 0; }

/* 按钮 */
.btn { display: inline-block; border: 1px solid #4f46e5; color: #4f46e5; background: #fff; border-radius: 6px; padding: 8px 18px; font-size: 14px; cursor: pointer; text-align: center; }
.btn:hover { background: #f1f0ff; opacity: 1; }
.btn-primary { background: #4f46e5; color: #fff; }
.btn-primary:hover { background: #4338ca; }
.btn-danger { border-color: #dc2626; color: #dc2626; }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-block { display: block; width: 100%; margin-top: 8px; }
.btn-added { background: #e5e7eb !important; border-color: #d1d5db !important; color: #6b7280 !important; cursor: default; pointer-events: none; }
.btn.loading { pointer-events: none; opacity: .85; }
.btn.loading::after { content: ''; display: inline-block; width: 14px; height: 14px; margin-left: 8px; vertical-align: -2px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: btnspin .7s linear infinite; }
@keyframes btnspin { to { transform: rotate(360deg); } }

/* 表格（移动端横向滚动，防止页面被撑大） */
.table { width: 100%; border-collapse: collapse; background: #fff; margin: 12px 0; font-size: 14px; }
.table th, .table td { padding: 10px 12px; border: 1px solid #ececec; text-align: left; }
.table th { background: #fafafa; font-weight: 600; }
.order-card, #cart-list, .detail-desc { overflow-x: auto; }
@media (max-width: 600px) {
  .howto { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .howto-step { padding: 14px 10px; }
  .howto-step b { font-size: 13px; }
  .howto-step p { font-size: 12px; }
  .table { font-size: 13px; }
  .table th, .table td { padding: 8px 6px; }
  .card-meta { font-size: 11px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .card { padding: 5px; gap: 4px; border-radius: 6px; }
  .card-title { font-size: 11px; line-height: 1.35; }
  h1 { font-size: 20px; }
  .header-inner { padding: 0 0 0 12px; justify-content: space-between; }
  .cart-link { padding: 0 16px; margin-left: 0; }
  .pay-modal { padding: 18px 14px; }
  .pay-modal .qrcode { width: 180px; height: 180px; }
}

/* 表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; margin-bottom: 6px; font-weight: 600; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid #ddd; border-radius: 6px; padding: 9px 12px; font-size: 16px; font-family: inherit; }
.field textarea { min-height: 120px; }
.radio { margin-right: 14px; font-size: 14px; }
.muted { color: #888; font-size: 13px; }

/* 提示 */
.alert { padding: 12px 14px; border-radius: 8px; margin: 14px 0; font-size: 14px; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }

/* 支付 */
.pay-box { background: #fff; border: 1px solid #ececec; border-radius: 10px; padding: 24px; text-align: center; }
.pay-amount { font-size: 18px; margin: 10px 0; }
.qrcode { display: inline-block; padding: 12px; border: 1px solid #eee; border-radius: 8px; margin: 14px 0; background: #fff; }

/* 订单 */
.order-form { background: #fff; border: 1px solid #ececec; border-radius: 10px; padding: 20px; margin: 16px 0; }
.order-card { background: #fff; border: 1px solid #ececec; border-radius: 10px; padding: 20px; margin: 16px 0; }
.status-sent { color: #15803d; }
.status-failed, .status-expired, .status-cancelled { color: #b91c1c; }
.status-paid, .status-processing, .status-pending, .status-partial { color: #b45309; }

/* 分页 */
.pager { display: flex; gap: 8px; justify-content: center; align-items: center; margin: 24px 0; flex-wrap: wrap; }
.pager a { background: #fff; border: 1px solid #ddd; border-radius: 6px; padding: 6px 12px; color: #555; font-size: 14px; text-decoration: none; }
.pager a:hover { border-color: #4f46e5; color: #4f46e5; }
.pager .now { font-size: 14px; color: #888; padding: 0 6px; }
.pager .off { background: #f5f5f5; border: 1px solid #eee; border-radius: 6px; padding: 6px 12px; color: #bbb; font-size: 14px; }

/* 页脚 */
.site-footer { border-top: 1px solid #e8e8e8; background: #fff; width: 100%; max-width: 900px; margin: 24px auto 0; padding: 18px 0; text-align: center; color: #999; font-size: 13px; box-sizing: border-box; }

.order-history-list { list-style: none; margin: 8px 0 20px; background: #fff; border: 1px solid #ececec; border-radius: 10px; padding: 8px 16px; }
.order-history-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed #eee; font-size: 14px; flex-wrap: wrap; }
.order-history-list li .js-remove-order { margin-left: auto; color: #999; border-color: #ddd; }
.order-history-list li .js-remove-order:hover { color: #b91c1c; border-color: #dc2626; background: #fef2f2; }

/* 后台样式已剥离至 admin/admin.css（仅后台加载） */

/* 搜索首页（hero） */
.search-hero { max-width: 640px; margin: 10vh auto 0; text-align: center; }
.hero-title { font-size: 34px; margin-bottom: 22px; color: #222; }
.search-hero .search input { font-size: 17px; padding: 12px 16px; }
.search-hero .search button { font-size: 16px; padding: 12px 26px; }
@media (max-width: 600px) {
  .search-hero { margin-top: 8vh; }
  .hero-title { font-size: 24px; }
}

/* 多卷聚合列表 */
.vol-list { margin: 22px 0; display: flex; flex-direction: column; gap: 10px; }
.vol-item { background: #fff; border: 1px solid #e8e8e8; border-radius: 8px; padding: 12px 14px; }
.vol-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.vol-name { font-size: 16px; font-weight: 700; color: #222; }
.vol-price { margin-left: auto; font-size: 16px; color: #e63946; font-weight: 700; }
.vol-meta { margin-top: 4px; font-size: 13px; color: #888; }
.vol-top form { margin-left: 12px; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.vol-desc { margin-top: 8px; padding-top: 8px; border-top: 1px dashed #eee; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.vol-line { font-size: 13px; color: #555; }
.type-select { margin: 14px 0; padding: 12px 14px; background: #f7f7f9; border: 1px solid #e8e8e8; border-radius: 8px; display: flex; gap: 18px; flex-wrap: wrap; align-items: center; font-size: 14px; }
.type-select .label-t { font-weight: 600; color: #333; }
.cart-actions { margin: 10px 0; text-align: right; }

@media (max-width: 600px) {
  .container { padding: 0 12px; }
  .header-inner { padding: 0 12px; }
}

/* 购物车列表白底卡片 */
#cart-list { background: #fff; border: 1px solid #ececec; border-radius: 10px; padding: 4px 16px; margin: 12px 0; }
#cart-list:empty { padding: 0; border: 0; background: none; margin: 0; }
.cart-items { margin: 10px 0 6px; }
.cart-row { display: flex; align-items: center; padding: 10px 0; border-bottom: 1px solid #f2f2f2; gap: 10px; }
.cart-row:last-child { border-bottom: 0; }
.cart-title { flex: 1; min-width: 0; overflow-wrap: break-word; }
.cart-price { flex: 1; text-align: right; color: #d33; font-weight: 600; white-space: nowrap; }
.cart-row .js-remove { background: none; border: 0; color: #999; cursor: pointer; padding: 4px 6px; font-size: 13px; flex: none; }
.cart-row .js-remove:hover { color: #d33; }
.cart-actions-top { margin: 2px 0 10px; text-align: right; }
.cart-total { text-align: right; padding: 10px 0 2px; font-size: 15px; color: #333; border-top: 1px dashed #eee; margin-top: 4px; }
.cart-total b { color: #d33; font-size: 18px; }
@media (max-width: 600px) {
  .vol-top { gap: 8px; }
  .vol-price { margin-left: 0; }
  .vol-top form { margin-left: auto; }
}

/* 加购飞入动画：书本从按钮飘进购物车 */
.fly-cart-item { position: fixed; z-index: 9999; pointer-events: none; font-size: 22px; line-height: 1; }
#cart-count.fly-pop { animation: fly-pop .4s cubic-bezier(.34,1.56,.64,1); }
@keyframes fly-pop { 0% { transform: scale(1); } 40% { transform: scale(1.5); } 100% { transform: scale(1); } }
.cart-link.fly-bump { animation: fly-bump .4s cubic-bezier(.34,1.56,.64,1); }
@keyframes fly-bump { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
