/* 与首页经文注解弹窗同壳：深褐顶栏 + 纸本正文 + 莲花暗纹 */

body.nj-ui-open {
  overflow: hidden;
}

.nj-ui-root {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  box-sizing: border-box;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.nj-ui-root.is-open {
  opacity: 1;
  pointer-events: auto;
}

.nj-ui-root[hidden] {
  display: none !important;
}

.nj-ui-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 12, 4, 0.52);
  backdrop-filter: blur(2px);
}

.nj-ui-panel {
  position: relative;
  z-index: 1;
  width: min(460px, 94vw);
  max-height: min(82vh, 700px);
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  background:
    linear-gradient(165deg, #fffdf8 0%, #f7edd4 58%, #f2e4c4 100%);
  border: 1px solid rgba(154, 122, 58, 0.55);
  box-shadow:
    0 24px 64px rgba(20, 10, 0, 0.38),
    0 0 0 1px rgba(255, 248, 230, 0.35) inset;
  transform: translateY(10px) scale(0.98);
  transition: transform 0.2s ease;
  color: #3a2412;
}

.nj-ui-root.is-open .nj-ui-panel {
  transform: translateY(0) scale(1);
}

.nj-ui-panel.is-ok {
  width: min(400px, 94vw);
  max-height: min(94vh, 680px);
}

.nj-ui-panel.is-ok .nj-ui-head {
  padding: 10px 12px 10px 14px;
}

.nj-ui-panel.is-ok .nj-ui-title {
  font-size: clamp(16px, 2vw, 20px);
}

.nj-ui-panel.is-ok .nj-ui-body {
  max-height: none;
  overflow: hidden !important;
  padding: 10px 14px 12px;
}

.nj-ui-panel.is-ok .nj-ui-body.is-scrollable {
  overflow: hidden !important;
  padding-right: 14px;
}

.nj-ui-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  background: linear-gradient(180deg, #5a3f1c 0%, #3d2a10 100%);
  border-bottom: 1px solid rgba(201, 162, 39, 0.55);
  position: relative;
  z-index: 2;
}

.nj-ui-title {
  flex: 1 1 auto;
  margin: 0;
  min-width: 0;
  padding: 0;
  font-family: "LXGW WenKai", "KaiTi", "STKaiti", serif;
  text-align: left;
  font-size: clamp(18px, 2.2vw, 24px);
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #fff4c8;
  line-height: 1.35;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

/* 覆盖站点全局 button{height:20px} */
button.nj-ui-close {
  flex: 0 0 auto;
  appearance: none;
  -webkit-appearance: none;
  width: auto !important;
  height: auto !important;
  min-width: 4.5em;
  min-height: 36px !important;
  margin: 0 !important;
  border: 1px solid rgba(240, 208, 120, 0.45) !important;
  background: rgba(255, 255, 255, 0.08) !important;
  color: #f0d078 !important;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif !important;
  font-size: 14px !important;
  font-weight: 600;
  letter-spacing: 0.16em;
  line-height: 1.25 !important;
  padding: 9px 16px 9px 18px !important;
  border-radius: 999px;
  cursor: pointer;
  box-sizing: border-box;
  overflow: visible;
  white-space: nowrap;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

button.nj-ui-close:hover,
button.nj-ui-close:focus-visible {
  background: rgba(255, 255, 255, 0.14) !important;
  color: #fff !important;
  outline: none;
}

.nj-ui-body {
  position: relative;
  z-index: 1;
  flex: 0 1 auto;
  min-height: 0;
  max-height: calc(min(82vh, 700px) - 64px);
  padding: 22px 26px 24px;
  overflow-x: hidden;
  overflow-y: hidden;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(122, 98, 54, 0.45) transparent;
}

.nj-ui-body.is-scrollable {
  overflow-y: auto;
  padding-right: 22px;
}

.nj-ui-body::-webkit-scrollbar {
  width: 8px;
}

.nj-ui-body::-webkit-scrollbar-thumb {
  background: rgba(122, 98, 54, 0.4);
  border-radius: 8px;
}

.nj-ui-body::-webkit-scrollbar-track {
  background: transparent;
}

.nj-ui-lead {
  position: relative;
  z-index: 1;
  margin: 0 0 16px;
  font-family: "LXGW WenKai", "KaiTi", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.85;
  letter-spacing: 0.04em;
  color: #5a3208;
  text-align: left;
}

.nj-ui-field-label {
  position: relative;
  z-index: 1;
  display: block;
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #6b4a1c;
}

.nj-ui-field {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 10px;
  padding: 13px 14px;
  border-radius: 10px;
  border: 1px solid rgba(154, 122, 58, 0.38);
  background: rgba(255, 253, 248, 0.92);
  font-size: 15px;
  color: #3a2412;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(80, 50, 10, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.nj-ui-field:focus {
  border-color: rgba(154, 122, 58, 0.72);
  box-shadow:
    inset 0 1px 2px rgba(80, 50, 10, 0.04),
    0 0 0 3px rgba(189, 135, 11, 0.16);
}

.nj-ui-hint {
  position: relative;
  z-index: 1;
  margin: 0 0 18px;
  font-size: 12px;
  line-height: 1.65;
  letter-spacing: 0.03em;
  color: #9a8260;
}

.nj-ui-divider {
  position: relative;
  z-index: 1;
  height: 1px;
  margin: 4px 0 16px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(154, 122, 58, 0.35) 18%,
    rgba(154, 122, 58, 0.35) 82%,
    transparent 100%
  );
  border: none;
}

.nj-ui-options {
  position: relative;
  z-index: 1;
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  max-height: 220px;
  overflow: auto;
}

.nj-ui-option {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 8px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(189, 135, 11, 0.22);
  background: rgba(255, 252, 244, 0.88);
  text-align: left;
  font-size: 14px;
  line-height: 1.45;
  color: #4a3518;
  cursor: pointer;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.nj-ui-option:hover,
.nj-ui-option.is-active {
  background: rgba(255, 244, 214, 0.95);
  border-color: rgba(189, 135, 11, 0.45);
}

.nj-ui-option small {
  display: block;
  margin-top: 4px;
  color: #9a8260;
  font-size: 12px;
}

.nj-ui-actions {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 6px;
}

button.nj-ui-btn {
  appearance: none;
  -webkit-appearance: none;
  width: auto !important;
  height: auto !important;
  min-height: 40px !important;
  margin: 0 !important;
  border-radius: 999px;
  padding: 0 20px !important;
  font-size: 14px !important;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1 !important;
  cursor: pointer;
  box-sizing: border-box;
  white-space: nowrap;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  text-align: center;
  vertical-align: middle;
  transition: background 0.15s ease, color 0.15s ease, filter 0.12s ease;
}

button.nj-ui-btn-primary {
  border: 1px solid rgba(201, 162, 39, 0.45) !important;
  background: linear-gradient(180deg, #5a3f1c 0%, #3d2a10 100%) !important;
  color: #fff4c8 !important;
  box-shadow: 0 2px 10px rgba(40, 24, 6, 0.22);
}

button.nj-ui-btn-primary:hover {
  filter: brightness(1.08);
}

button.nj-ui-btn-ghost {
  border: 1px solid rgba(154, 122, 58, 0.4) !important;
  background: rgba(255, 255, 255, 0.35) !important;
  color: #6b4a1c !important;
}

button.nj-ui-btn-ghost:hover {
  background: rgba(255, 248, 230, 0.85) !important;
}

/* —— 回向确认 / 圆满（一屏紧凑） —— */
.nj-ui-ok {
  position: relative;
  z-index: 1;
  text-align: center;
}

.nj-ui-ok.is-compact .nj-ui-ok-name {
  display: none;
}

.nj-ui-ok-img-wrap {
  margin: 0 auto 6px;
  width: min(100%, 240px);
  max-height: none;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(154, 122, 58, 0.35);
  background: #0e0a06;
  box-shadow: 0 6px 18px rgba(40, 20, 0, 0.16);
  line-height: 0;
}

.nj-ui-ok-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(260px, 34vh);
  object-fit: contain;
  object-position: center top;
  background: #0e0a06;
}

.nj-ui-ok-merit {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: stretch;
  margin: 6px 0 2px;
}

.nj-ui-ok-merit-item {
  flex: 1 1 0;
  min-width: 0;
  padding: 5px 6px 6px;
  border-radius: 8px;
  background: linear-gradient(180deg, #fffaf0, #f3e8d0);
  border: 1px solid rgba(154, 122, 58, 0.28);
  box-sizing: border-box;
}

.nj-ui-ok-merit-item.is-total {
  background: linear-gradient(180deg, #f8f1e0, #ebe0c0);
  border-color: rgba(120, 90, 40, 0.36);
}

.nj-ui-ok-merit-label {
  display: block;
  margin: 0 0 2px;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: #8a6a28;
  font-weight: 600;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

.nj-ui-ok-merit-val {
  display: block;
  font-family: "LXGW WenKai", "KaiTi", "STKaiti", serif;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #8b1e1e;
  line-height: 1.1;
}

.nj-ui-ok-merit-item.is-total .nj-ui-ok-merit-val {
  color: #5a3208;
}

.nj-ui-ok-merit-val small {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #a07a30;
  margin-left: 2px;
}

.nj-ui-ok-kicker {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: #a07a30;
  font-family: "LXGW WenKai", "KaiTi", serif;
}

.nj-ui-ok-name {
  margin: 0 0 8px;
  font-family: "LXGW WenKai", "KaiTi", "STKaiti", serif;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #8b1e1e;
  line-height: 1.25;
}

.nj-ui-ok-stats {
  margin: 0 auto 4px;
  max-width: 28em;
  font-size: 13px;
  line-height: 1.55;
  letter-spacing: 0.02em;
  color: #5a3208;
  font-family: "LXGW WenKai", "KaiTi", "Microsoft YaHei", sans-serif;
}

.nj-ui-ok-stats b {
  color: #8b1e1e;
  font-weight: 800;
}

.nj-ui-ok-bless {
  margin: 6px 0 2px;
  font-family: "LXGW WenKai", "KaiTi", serif;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: #6b4a1c;
}

.nj-ui-ok-auto {
  margin: 0 0 6px;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: #b09870;
}

.nj-ui-ok .nj-ui-actions {
  justify-content: center;
  margin-top: 4px;
}

.nj-ui-ok.is-compact .nj-ui-btn {
  min-height: 36px !important;
  padding: 8px 18px 8px 20px !important;
  font-size: 13px !important;
}

/* 装饰暗纹：与注解弹窗同源 */
.nj-ui-lotus,
.nj-ui-ting,
.nj-ui-seal {
  position: absolute;
  pointer-events: none;
  z-index: 0;
}

.nj-ui-lotus {
  right: -4%;
  bottom: -2%;
  width: min(280px, 70%);
  height: min(180px, 46%);
  background-color: #8a6a38;
  -webkit-mask: url("../jing-img/decor/lotus-ornament.svg") no-repeat right bottom / contain;
  mask: url("../jing-img/decor/lotus-ornament.svg") no-repeat right bottom / contain;
  opacity: 0.11;
}

.nj-ui-ting {
  left: 16px;
  top: 78px;
  width: 44px;
  height: 44px;
  background-color: #6b5528;
  -webkit-mask: url("../jing-img/decor/tingchan-ornament.svg") no-repeat center / contain;
  mask: url("../jing-img/decor/tingchan-ornament.svg") no-repeat center / contain;
  opacity: 0.07;
}

.nj-ui-seal {
  right: 16px;
  bottom: 12px;
  width: 38px;
  height: 38px;
  background-color: #8b3a2a;
  -webkit-mask: url("../jing-img/decor/buddha-hand.svg") no-repeat center / contain;
  mask: url("../jing-img/decor/buddha-hand.svg") no-repeat center / contain;
  opacity: 0.12;
}

@media (max-width: 420px) {
  .nj-ui-panel,
  .nj-ui-panel.is-ok {
    width: 96vw;
  }

  .nj-ui-body {
    padding: 18px 16px 20px;
  }

  .nj-ui-panel.is-ok .nj-ui-body {
    padding: 8px 12px 10px;
  }

  .nj-ui-ok-img-wrap {
    width: min(100%, 200px);
  }

  .nj-ui-ok-img {
    max-height: min(210px, 30vh);
  }

  .nj-ui-ok-merit-val {
    font-size: 16px;
  }
}

@media (max-height: 700px) {
  .nj-ui-ok-img {
    max-height: min(200px, 28vh);
  }

  .nj-ui-root {
    padding: 10px 10px;
  }
}
