/* ============================================================
   神仙渡 · 许愿司 — 功德箱（捐款换香火币）
   ============================================================ */

/* 功德箱：横贯殿前，两栏——左为捐款，右为我的功德 */
.donate {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 34px; margin-top: 46px; padding: 30px 32px 28px;
  position: relative; overflow: hidden;
}
.donate::after {                     /* 破格：右下角大印 */
  content: '德';
  position: absolute; right: 8px; bottom: -34px;
  font-family: var(--font-cn); font-size: 150px; color: var(--gold);
  opacity: .045; pointer-events: none; line-height: 1;
}
.donate::before {                    /* 顶沿一线鎏金，喻箱沿 */
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}
.donate .offer-tit { margin-bottom: 8px; }
.donate .offer-tit i { color: var(--cinnabar-hi); }
.donate .hint { margin: 0 0 16px; font-size: 12px; color: var(--ash); line-height: 1.95; }
.donate .hint b { color: #d8a08f; font-weight: 400; }

.dn-main, .dn-side { min-width: 0; position: relative; z-index: 2; }
.dn-side {
  padding-left: 30px;
  border-left: 1px dashed var(--line);
}

/* ---- 金额档位 ---- */
.dn-tier {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 7px; margin-bottom: 13px;
}
.dn-tier button {
  cursor: pointer; padding: 9px 0;
  background: var(--ink-2); border: 1px solid var(--line-soft);
  color: var(--paper-dim); font-family: var(--font-num); font-size: 14px;
  letter-spacing: .5px; transition: .22s var(--ease);
}
.dn-tier button:hover {
  color: var(--gold-hi); border-color: var(--gold-dim);
  background: rgba(228,185,95,.08);
}

/* ---- 自定义金额 ---- */
.dn-row { display: flex; align-items: center; gap: 9px; }
.dn-row input {
  flex: 1; min-width: 0; background: rgba(7,5,4,.7);
  border: 1px solid var(--line); color: var(--paper);
  font-family: var(--font-num); font-size: 19px;
  padding: 11px 13px; outline: none; transition: border-color .2s var(--ease);
}
.dn-row input:focus { border-color: var(--gold); }
.dn-row input::-webkit-outer-spin-button,
.dn-row input::-webkit-inner-spin-button { opacity: .35; }
.dn-unit { font-size: 13px; color: var(--ash); flex: none; }

.dn-quote {
  margin-top: 9px; min-height: 20px;
  font-size: 12.5px; color: var(--ash); letter-spacing: .06em;
}
.dn-quote b {
  font-family: var(--font-num); font-size: 19px; color: var(--gold-hi); font-weight: 400;
}
.dn-q-err { color: #e0a49c; }

.dn-label {
  display: block; margin: 16px 0 6px;
  font-size: 11.5px; letter-spacing: 2px; color: var(--paper-dim);
}
.dn-bless {
  width: 100%; background: rgba(7,5,4,.7);
  border: 1px solid var(--line); color: var(--paper);
  font-family: var(--font-body); font-size: 13.5px;
  padding: 10px 13px; outline: none; transition: border-color .2s var(--ease);
}
.dn-bless:focus { border-color: var(--gold); }
.dn-bless::placeholder, .dn-row input::placeholder { color: var(--ash); opacity: .65; }
/* 兼容正殿原有的 id 选择器（勿删：#dnBless 仍在 index.html 的正殿区块里使用，
   但已改为统一挂 .dn-bless，此处仅作旧样式兜底） */
#dnBless { width: 100%; background: rgba(7,5,4,.7); border: 1px solid var(--line); color: var(--paper); font-family: var(--font-body); font-size: 13.5px; padding: 10px 13px; outline: none; }
#dnBless:focus { border-color: var(--gold); }

.dn-btn { width: 100%; margin-top: 18px; }
.dn-btn:disabled { opacity: .4; cursor: not-allowed; }
.dn-tip {
  margin-top: 11px; text-align: center;
  font-size: 10.5px; color: var(--ash); letter-spacing: .04em; line-height: 1.8;
}

/* ---- 右侧：来源摘要与记录 ---- */
.dn-stat { display: flex; flex-direction: column; gap: 7px; }
.dn-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; font-size: 12px; color: var(--paper-dim);
  letter-spacing: .04em;
  background: rgba(228,185,95,.05); border-left: 2px solid var(--gold-dim);
}
.dn-chip i { color: var(--gold); font-size: 12px; flex: none; }
.dn-chip.on { border-left-color: var(--cinnabar); }
.dn-chip.on i { color: var(--cinnabar-hi); }
.dn-need { font-size: 12px; color: var(--ash); letter-spacing: .06em; }

.dn-kpis {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin: 16px 0;
}
.dn-kpis > div { text-align: center; padding: 11px 4px; border: 1px solid var(--line-soft); }
.dn-kpis b {
  display: block; font-family: var(--font-num); font-weight: 400;
  font-size: 21px; color: var(--gold);
}
.dn-kpis span { font-size: 10.5px; color: var(--ash); letter-spacing: .04em; }

.dn-h {
  margin: 0 0 8px; font-size: 11.5px; font-weight: 400;
  letter-spacing: 3px; color: var(--gold-dim);
}
.dn-log { list-style: none; margin: 0; }
.dn-log li {
  display: flex; align-items: baseline; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--line-soft);
  font-size: 12px; color: var(--paper-dim);
}
.dn-log li:last-child { border-bottom: none; }
.dn-log li > span { font-family: var(--font-num); font-size: 11px; color: var(--ash); flex: none; }
.dn-log li > b { font-family: var(--font-num); font-weight: 400; color: var(--paper); flex: none; }
.dn-log li > em {
  font-family: var(--font-num); font-style: normal;
  color: var(--gold); flex: none; min-width: 42px; text-align: right;
}
.dn-log li > i {
  font-style: normal; color: var(--ash); font-size: 11.5px;
  flex: 1; min-width: 0; text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dn-empty { font-size: 12px; color: var(--ash); line-height: 2; margin: 0; }

/* ---- 窄屏：两栏改单栏 ---- */
@media (max-width: 900px) {
  .donate { grid-template-columns: 1fr; gap: 22px; padding: 24px 20px; }
  .dn-side { padding-left: 0; padding-top: 20px; border-left: none; border-top: 1px dashed var(--line); }
}
@media (max-width: 480px) {
  .dn-tier { grid-template-columns: repeat(3, 1fr); }
  .dn-kpis b { font-size: 18px; }
}
/* ---- 窄屏触控目标与最小字号 ----
   香火档位快捷键（.dn-tier button）原高 41px、「祈愿」标签 11.5px、
   提示 10.5px，手机上点不准也偏小，此处补足。
   （原先这些规则误写在 main.css 的 640px 断点里，但类定义在本文件，
     选择器写错文件等于无效。断点取 900：iPad 竖屏 768 同样是触屏。） */
@media (max-width: 900px) {
  .dn-tier button { min-height: 44px; -webkit-tap-highlight-color: rgba(228,185,95,.16); }
  .dn-label, .dn-tip { font-size: 12px; }
  /* 「祈愿（可选）」标签是可点 label（聚焦输入框），原行高 16px 点击区太窄 */
  .dn-label { line-height: 2.2; }
  .dn-input, .dn-main input { min-height: 44px; }
  .shop-coin-tip { font-size: 12px; }
  /* 右侧「近期捐款」与 KPI 标签：登录后才有内容，
     游客态审计测不出这两处，须登录态复测才不漏 */
  .dn-kpis span { font-size: 12px; }
  .dn-log li > span { font-size: 12px; }
  .dn-log li > i { font-size: 12px; }
  .dn-h { font-size: 12px; }
}
/* ---- 香烛页：香火币来源指引 ---- */
.shop-coin-tip {
  margin: 9px 0 0; padding: 8px 13px; font-size: 11.5px;
  color: var(--ash); letter-spacing: .04em; line-height: 1.9;
  background: rgba(228,185,95,.05); border-left: 2px solid var(--gold-dim);
}
.shop-coin-tip b { color: var(--gold-dim); font-weight: 400; }

/* ============================================================
   功德箱悬浮入口与弹层（各页通用）
   ------------------------------------------------------------
   正殿的 .donate 是横贯区块，此处是右下角悬浮件：按钮固定在
   香囊 FAB 之上（.cart-fab right/bottom 26px、62px 见 main.css），
   故功德箱上移 78px 让位。z-index 取 70，与 .cart-fab 同级，
   低于抽屉（120）与各弹层（200），故开抽屉/弹层时不会浮在之上。
   ============================================================ */

/* ---- 悬浮按钮 ---- */
.dn-fab {
  position: fixed; right: 26px; bottom: 100px; z-index: 70; cursor: pointer;
  width: 62px; height: 62px; border-radius: 50%;
  display: grid; place-items: center; gap: 0;
  background: linear-gradient(150deg, #3a2c17, #1d1608); color: var(--gold-hi);
  border: 1px solid var(--gold-dim); font-size: 19px;
  box-shadow: 0 10px 30px rgba(0,0,0,.7); transition: .3s var(--ease);
}
.dn-fab:hover { transform: scale(1.07); border-color: var(--gold); }
/* 「功德箱」三字压在图标下方，字号 9.5px 已低于可读下限，
   故不叠在一枚 62px 的圆里——改为圆右侧外挂一枚横排小签，
   既保住 44px 触控直径，也让文字能到 12px。 */
.dn-fab .lb {
  position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%);
  white-space: nowrap; font-family: var(--font-body); font-size: 12px;
  letter-spacing: 2px; color: var(--gold-dim);
  background: rgba(12,9,7,.88); border: 1px solid var(--line);
  padding: 5px 9px; border-radius: 3px; pointer-events: none;
  opacity: 0; transition: .3s var(--ease);
}
.dn-fab:hover .lb, .dn-fab:focus-visible .lb { opacity: 1; }

/* ---- 弹层 ---- */
.fb-modal {
  position: fixed; inset: 0; z-index: 200; display: none;
  align-items: center; justify-content: center; padding: 22px;
  background: rgba(4,3,2,.84); backdrop-filter: blur(9px);
}
.fb-modal.on { display: flex; animation: fade .35s both; }
.fb-card {
  position: relative;
  width: 100%; max-width: 430px; max-height: 90vh; overflow-y: auto;
  padding: 30px 28px 26px;
  background: linear-gradient(170deg, #221a13, #120d09 62%);
  border: 1px solid var(--gold-dim);
  box-shadow: 0 0 70px rgba(0,0,0,.7), inset 0 0 46px rgba(0,0,0,.6);
  animation: pop .45s var(--ease) both;
}
.fb-card::after {                     /* 破格大印，与正殿功德箱同一印记 */
  content: '德'; position: absolute; right: 6px; bottom: -30px;
  font-family: var(--font-cn); font-size: 120px; color: var(--gold);
  opacity: .05; pointer-events: none; line-height: 1;
}
.fb-head { text-align: center; margin-bottom: 20px; position: relative; z-index: 2; }
.fb-head .seal {
  width: 50px; height: 50px; margin: 0 auto 12px; display: grid; place-items: center;
  font-family: var(--font-cn); font-size: 25px; color: var(--gold-hi);
  border: 1px solid var(--line);
  background: radial-gradient(circle at 36% 28%, rgba(228,185,95,.24), rgba(13,10,8,.9) 68%);
}
.fb-head h3 {
  font-family: var(--font-cn); font-weight: 400; font-size: 24px;
  letter-spacing: 5px; color: var(--gold-hi); margin-bottom: 8px;
}
.fb-head p { font-size: 12px; color: var(--ash); line-height: 1.95; }
.fb-head p b { color: #d8a08f; font-weight: 400; }
.fb-body { position: relative; z-index: 2; }

/* 窄屏：悬浮件让位与触控补足 */
@media (max-width: 900px) {
  /* 900px 断点不能直接把 bottom 压到 82px：.cart-fab 的缩小规则在 640px 断点，
     故 641~900px 区间它仍是 62px 高 + bottom 26px，顶边高达 88px。
     功德箱若取 82px 会与之重叠 6px，故此区间取 100px（=26+62+12 让位），
     真正的手机区间（≤640px）香囊已缩到 52px，再由下面的规则收到 82px。 */
  .dn-fab { width: 52px; height: 52px; right: 16px; bottom: 100px; font-size: 17px;
    -webkit-tap-highlight-color: rgba(228,185,95,.16); }
  .dn-fab .lb { display: none; }   /* 触屏无 hover，标签常显反成噪声 */
  .fb-card { padding: 24px 18px 22px; }
  .fb-head p { font-size: 12px; }
  .fb-modal { padding: 16px; }
  /* 弹层内的祈愿输入与捐款按钮：正殿那套 min-height 补丁挂在 .dn-main 下，
     浮层用的是 .fb-body，选择器够不着，故在此按类补足。 */
  .fb-body .dn-bless { min-height: 44px; }
  .fb-body .dn-btn { min-height: 44px; }
}
@media (max-width: 640px) {
  /* .cart-fab 已缩为 52px + bottom 16px，顶边 68px，功德箱收到 82px 即可 */
  .dn-fab { bottom: 82px; }
}
