/* ============================================================
 * 赞赏卡片样式（5.6.64 / 2026-11-09）
 * ------------------------------------------------------------
 * 形态变更：从「左下角悬浮爱心 + 遮罩弹窗」改为「内嵌在正文之后的一张卡片」。
 *
 * 为什么不再用 fixed：
 *   悬浮件是压在页面上的，跟正文抢位置；手机端还要跟底部标签栏、返回顶部、
 *   语言按钮算高度，换个模板就得重算一次。内嵌之后它就是正文流里的一块，
 *   滚动时跟着文章走，两端布局自然一致，不用再关心别人占了哪个角。
 *
 * 落点：由 SSR（server.js ssrPostBody）与客户端重绘（public/post.html render）
 *       分别注入到 .body.md-body 之后、.post-acts 之前。两处必须都插 ——
 *       render() 会整块重写 #postDetail，只写 SSR 的话用户一打开标记就没了。
 * 命名统一 kw- 前缀，不与 style.css / mobile.css 已有类冲突。
 * ============================================================ */

.kw-card {
  position: relative;
  margin: 26px 0 4px;
  padding: 16px 16px 13px;
  border: 1px solid #edeef1;
  border-radius: 14px;
  background: #fcfcfd;
  box-sizing: border-box;
}

/* ---------- 头部 ---------- */
.kw-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 13px;
}
.kw-heart {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f2453d;
  background: linear-gradient(140deg, #fff1ef 0%, #ffe3df 100%);
}
.kw-heart svg { width: 19px; height: 19px; display: block; }
.kw-htxt { flex: 1 1 auto; min-width: 0; }
.kw-title {
  font-size: 15px;
  font-weight: 700;
  color: #1f2328;
  line-height: 1.35;
}
.kw-sub {
  margin-top: 3px;
  font-size: 12px;
  color: #9aa0a6;
  line-height: 1.5;
}

/* 关闭：只在卡片右上角，点掉就整块收起（display:none，不占位） */
.kw-x {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: #b9bec5;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  -webkit-tap-highlight-color: transparent;
}
.kw-x:hover { background: #f2f3f5; color: #7b8189; }
.kw-x svg { width: 14px; height: 14px; display: block; }

/* ---------- 金额网格 ----------
 * 手机 3 列 → 6 个档位两行；桌面 6 列 → 一行排开。
 * 用 min-height 预留高度，JS 填档位时不会把下面的互动条顶下去。 */
.kw-amts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  min-height: 118px;
}
.kw-amt {
  position: relative;
  padding: 9px 4px 8px;
  border: 1.5px solid #e8eaed;
  border-radius: 11px;
  background: #fff;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  transition: border-color .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.kw-amt:hover { border-color: #ffc7c2; background: #fffaf9; }
.kw-amt.on { border-color: #f2453d; background: #fff5f4; }
.kw-amt.on::after {
  content: '';
  position: absolute; right: -1.5px; bottom: -1.5px;
  width: 15px; height: 15px;
  background: #f2453d;
  border-radius: 0 0 10px 0;
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}
.kw-amt.on::before {
  content: '';
  position: absolute; right: 2px; bottom: 3px; z-index: 1;
  width: 8px; height: 4px;
  border-left: 1.5px solid #fff;
  border-bottom: 1.5px solid #fff;
  transform: rotate(-45deg);
}
.kw-amt-v { display: block; font-size: 16px; font-weight: 700; color: #1f2328; line-height: 1.2; }
.kw-amt.on .kw-amt-v { color: #e63b33; }
.kw-amt-n { display: block; font-size: 10.5px; color: #9aa0a6; margin-top: 2px; line-height: 1.3; }
.kw-amt-custom .kw-amt-v { font-size: 13px; font-weight: 600; color: #5b6168; }

/* ---------- 自定义金额 ---------- */
.kw-cin { display: none; margin-top: 9px; }
.kw-cin.on { display: block; }
.kw-cin-row {
  display: flex; align-items: center; gap: 8px;
  border: 1.5px solid #e8eaed; border-radius: 11px; padding: 0 12px; height: 42px;
  background: #fff;
  transition: border-color .15s;
}
.kw-cin-row:focus-within { border-color: #f2453d; }
.kw-cin-cur { font-size: 14px; color: #8b9199; flex: 0 0 auto; }
.kw-cin input {
  flex: 1 1 auto; min-width: 0; border: 0; outline: 0; background: none;
  font-size: 16px; font-weight: 700; color: #1f2328; font-family: inherit;
  -moz-appearance: textfield;
}
.kw-cin input::-webkit-outer-spin-button,
.kw-cin input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.kw-cin-hint { font-size: 11px; color: #9aa0a6; margin-top: 6px; padding-left: 2px; }
.kw-cin-hint.bad { color: #e63b33; }

/* ---------- 主按钮 ---------- */
.kw-go {
  width: 100%; height: 44px; margin-top: 11px;
  border: 0; border-radius: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 14.5px; font-weight: 700; font-family: inherit; color: #fff;
  background: linear-gradient(135deg, #1677ff 0%, #0e5fd8 100%);
  box-shadow: 0 4px 12px rgba(22, 119, 255, .26);
  transition: transform .12s, box-shadow .15s, opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.kw-go:hover { box-shadow: 0 6px 16px rgba(22, 119, 255, .34); }
.kw-go:active { transform: scale(.99); }
.kw-go:disabled { opacity: .6; cursor: default; transform: none; box-shadow: none; }
.kw-go svg { width: 16px; height: 16px; flex: 0 0 auto; }

.kw-err {
  display: none;
  margin-top: 9px; padding: 8px 10px; border-radius: 9px;
  background: #fff2f1; border: 1px solid #ffd9d6;
  font-size: 12px; color: #c8322b; line-height: 1.55;
}
.kw-err.on { display: block; }

.kw-foot {
  margin-top: 11px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 11.5px; color: #a8aeb5; flex-wrap: wrap;
}
.kw-more { color: #8b9199; text-decoration: underline; text-underline-offset: 2px; }
.kw-more:hover { color: #f2453d; }

/* ---------- 桌面：六档一行，卡片内边距放宽 ---------- */
@media (min-width: 721px) {
  .kw-card { padding: 18px 20px 15px; }
  .kw-amts { grid-template-columns: repeat(6, minmax(0, 1fr)); min-height: 0; }
  .kw-sub { font-size: 12.5px; }
}

/* ---------- 手机：内边距收窄，避免小屏两侧被挤 ---------- */
@media (max-width: 720px) {
  .kw-card { margin: 22px 0 2px; padding: 14px 13px 12px; border-radius: 13px; }
  .kw-heart { width: 34px; height: 34px; border-radius: 10px; }
  .kw-heart svg { width: 17px; height: 17px; }
  .kw-title { font-size: 14.5px; }
  .kw-sub { font-size: 11.5px; }
  .kw-amts { gap: 8px; min-height: 110px; }
  .kw-amt { padding: 8px 3px 7px; border-radius: 10px; }
  .kw-amt-v { font-size: 15px; }
  .kw-amt-n { font-size: 10px; }
  .kw-go { height: 46px; font-size: 15px; }
}

/* ---------- 暗色主题 ---------- */
html[data-theme="dark"] .kw-card { background: #1c1f24; border-color: #2b3037; }
html[data-theme="dark"] .kw-title { color: #e9ebee; }
html[data-theme="dark"] .kw-sub { color: #8d939b; }
html[data-theme="dark"] .kw-heart { background: linear-gradient(140deg, #3a2624 0%, #4a2b28 100%); }
html[data-theme="dark"] .kw-amt { background: #262a30; border-color: #343941; }
html[data-theme="dark"] .kw-amt:hover { border-color: #5a3c39; background: #2b2529; }
html[data-theme="dark"] .kw-amt.on { border-color: #f2453d; background: #33262a; }
html[data-theme="dark"] .kw-amt-v { color: #e9ebee; }
html[data-theme="dark"] .kw-amt.on .kw-amt-v { color: #ff837a; }
html[data-theme="dark"] .kw-amt-n { color: #868c94; }
html[data-theme="dark"] .kw-cin-row { border-color: #343941; background: #23272d; }
html[data-theme="dark"] .kw-cin-row:focus-within { border-color: #f2453d; }
html[data-theme="dark"] .kw-cin input { color: #e9ebee; }
html[data-theme="dark"] .kw-x:hover { background: #2c3037; color: #b8bdc4; }
html[data-theme="dark"] .kw-err { background: #3a2321; border-color: #5a3230; color: #ff9a92; }
html[data-theme="dark"] .kw-foot { color: #7b8189; }
html[data-theme="dark"] .kw-more { color: #7b8189; }

@media (prefers-reduced-motion: reduce) {
  .kw-amt, .kw-go, .kw-x { transition: none; }
}

/* ============================================================
 * 收款方式切换（5.6.64）
 * ------------------------------------------------------------
 * 支付宝 = 在线下单（自动入账）；微信 = 固定经营码（一张图，不依赖接口）。
 * 做成 tab 而不是并排两块：卡片内嵌在正文里，纵向空间紧张，
 * 并排会让高度接近翻倍，把后面的互动条挤到屏幕外。
 * ============================================================ */
.kw-tabs {
  display: flex; gap: 4px; margin-top: 13px; padding: 3px;
  background: #f2f3f5; border-radius: 11px;
}
.kw-tab {
  flex: 1 1 0; height: 30px; border: 0; border-radius: 8px;
  background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-family: inherit; font-size: 12.5px; font-weight: 700; color: #7b8189;
  transition: background .15s, color .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}
.kw-tab.is-on { background: #fff; color: #1f2328; box-shadow: 0 1px 3px rgba(16, 24, 40, .10); }
.kw-tab:not(.is-on):hover { color: #4a5057; }

.kw-pane { padding-top: 11px; }
.kw-pane[hidden] { display: none; }

/* ---------- 微信：静态经营码 ---------- */
.kw-pane-wx { text-align: center; }
.kw-wx {
  display: inline-block; padding: 7px; background: #fff;
  border: 1px solid #edeef1; border-radius: 12px;
}
.kw-wx img { display: block; width: 148px; height: auto; border-radius: 5px; }
.kw-wx-tip { margin: 10px 0 0; font-size: 12.5px; font-weight: 600; color: #3f454c; line-height: 1.5; }
.kw-wx-sub { margin: 5px 0 0; font-size: 11.5px; color: #9aa0a6; line-height: 1.6; }

@media (max-width: 720px) {
  .kw-tab { height: 32px; font-size: 13px; }
  .kw-wx { padding: 6px; }
  .kw-wx img { width: 134px; }
  .kw-wx-tip { font-size: 12px; }
  .kw-wx-sub { font-size: 11px; }
}

/* 二维码必须白底黑码才扫得动，暗色下不能跟着变深 */
html[data-theme="dark"] .kw-tabs { background: #23272d; }
html[data-theme="dark"] .kw-tab { color: #868c94; }
html[data-theme="dark"] .kw-tab.is-on { background: #2f343b; color: #e9ebee; box-shadow: none; }
html[data-theme="dark"] .kw-wx { background: #fff; border-color: #343941; }
html[data-theme="dark"] .kw-wx-tip { color: #cfd4da; }
html[data-theme="dark"] .kw-wx-sub { color: #868c94; }

/* 2026-11-24：首屏前由内联脚本判定隐藏，避免卡片「闪一下再消失」 */
.kw-tip-hidden .kw-card { display: none !important; }
