/* 字体家族使用独有名称，避免与宿主页面自带的 "Cardo" 冲突 */
/* Cardo (Google Fonts, v21) — 已下载到本地 bible/font/，不依赖外部 CDN */
@font-face {
  font-family: 'AB Cardo';
  src: url('../font/Cardo-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'AB Cardo';
  src: url('../font/Cardo-Regular-latin-ext.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'AB Cardo';
  src: url('../font/Cardo-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'AB Cardo';
  src: url('../font/Cardo-Bold-latin-ext.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'AB Cardo';
  src: url('../font/Cardo-Italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'AB Cardo';
  src: url('../font/Cardo-Italic-latin-ext.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Google Fonts 官方示例类名，作用域限定在 .ab-app 内 */
.ab-app .cardo-regular {
  font-family: 'AB Cardo', serif;
  font-weight: 400;
  font-style: normal;
}
.ab-app .cardo-bold {
  font-family: 'AB Cardo', serif;
  font-weight: 700;
  font-style: normal;
}
.ab-app .cardo-regular-italic {
  font-family: 'AB Cardo', serif;
  font-weight: 400;
  font-style: italic;
}

.ab-app {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  isolation: isolate;
  font-family: 'AB Cardo', 'Times New Roman', Georgia, serif;
  font-size: 16px;
  font-weight: 400;
  font-style: normal;
  line-height: 1.5;
  letter-spacing: normal;
  word-spacing: normal;
  text-align: left;
  text-transform: none;
  color: rgb(0, 0, 0);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  background-color: #000;
  -webkit-touch-action: none;
  touch-action: none;
}

.ab-app * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  border: none;

  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;

  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;

  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;

  -webkit-tap-highlight-color: transparent;
  -webkit-user-drag: none;

  -webkit-overscroll-behavior: none;
  overscroll-behavior: none;

  color: inherit;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  font-style: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  word-spacing: inherit;
  text-align: inherit;
  text-transform: none;
  text-shadow: inherit;
}

.ab-app .ab-hidden {
  display: none;
}

.ab-app .ab-save-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  background: rgba(0, 0, 0, 0.86);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  cursor: pointer;
}

.ab-app .ab-save-overlay img {
  max-width: 84%;
  max-height: 72%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.65);
  -webkit-touch-callout: default;
  -webkit-user-select: auto;
  user-select: auto;
  cursor: auto;
}

.ab-app .ab-save-hint {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: rgba(0, 0, 0, 0.9);
  text-align: center;
}

.ab-app .ab-save-btn {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  color: rgb(0, 0, 0);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 6px;
  padding: 8px 22px;
  cursor: pointer;
}

.ab-app .ab-save-btn:active {
  background: rgba(255, 255, 255, 0.25);
}

#ab-bible-cover {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url('../img/bg1.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  -webkit-transition: opacity 0.6s ease;
  transition: opacity 0.6s ease;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  overflow: hidden;
}

#ab-bible-cover.ab-fade-out {
  opacity: 0;
  pointer-events: none;
}

#ab-bible-confirm {
  position: absolute;
  cursor: pointer;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
}

#ab-bible-confirm.ab-positioned {
  opacity: 1;
  pointer-events: auto;
}

#ab-bible-result {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url('../img/bg2.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  -webkit-transition: opacity 0.6s ease;
  transition: opacity 0.6s ease;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

#ab-bible-result.ab-fade-in {
  opacity: 1;
}

#ab-bible-content {
  margin: 0 auto;
  position: absolute;
  top: 50%;
  transform: translateY(-70%);
  left: 0;
  right: 0;
  width: 80%;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

#ab-bible-verse-box {
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}

#ab-bible-verse-ref {
  font-size: 6vw;
  margin-bottom: 4vh;
}

#ab-bible-verse-text {
  font-size: 4.2vw;
  line-height: 1.35;
}

#ab-bible-back {
  position: absolute;
  right: 0;
  margin: 10px;
  border: 1px solid rgb(0, 0, 0);
  border-radius: 5px;
  padding: 5px 10px;
  cursor: pointer;
  z-index: 1;
}

#ab-bible-back:active {
  background-color: #444;
  color: #fff;
}

#ab-bible-share {
  position: absolute;
  left: 0;
  margin: 10px;
  border: 1px solid rgb(0, 0, 0);
  border-radius: 5px;
  padding: 5px 10px;
  cursor: pointer;
  z-index: 1;
}

#ab-bible-share:active {
  background-color: #444;
  color: #fff;
}

/* 底部购物按钮：固定在屏幕底部居中，封面页与经文页始终可见，方便点按 */
#ab-bible-shop {
  position: absolute;
  left: 50%;
  /* 先给不支持 env() 的旧浏览器一个回退值，再让新浏览器叠加安全区 */
  bottom: 28px;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  -webkit-transform: translateX(-50%);
  transform: translateX(-50%);
  width: 140px;
  /* 44px 是移动端最小可点区域，保证拇指点击的命中率 */
  height: 44px;
  cursor: pointer;
  z-index: 5;
  -webkit-transition: -webkit-transform 0.12s ease;
  transition: transform 0.12s ease;
}

#ab-bible-shop img {
  display: block;
  width: 100%;
  height: 100%;
  /* 原图比例 403:113 与 140:44 有差异，contain 让 logo 按原比例居中显示、不被拉伸 */
  -o-object-fit: contain;
  object-fit: contain;
}

#ab-bible-shop:active {
  -webkit-transform: translateX(-50%) scale(0.95);
  transform: translateX(-50%) scale(0.95);
}

/* 音乐署名入口：左下角文字按钮，刻意压低对比度，不抢画面主体 */
#ab-bible-credits {
  position: absolute;
  left: 14px;
  /* 先给不支持 env() 的旧浏览器一个回退值，再让新浏览器叠加安全区 */
  bottom: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  font-size: 12px;
  line-height: 1.2;
  /* 页面为浅色背景 + 黑色正文，这里沿用同一色系，压低透明度保持低调 */
  color: rgba(0, 0, 0, 0.5);
  text-decoration: underline;
  text-decoration-color: rgba(0, 0, 0, 0.28);
  text-underline-offset: 2px;
  cursor: pointer;
  z-index: 5;
  -webkit-transition: color 0.15s ease;
  transition: color 0.15s ease;
}

#ab-bible-credits:hover,
#ab-bible-credits:active {
  color: rgba(0, 0, 0, 0.85);
}

/* 署名详情弹层 */
#ab-bible-credits-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.92);
  /* .ab-app 全局禁用了触摸手势，这里要放开，长内容才能上下滚 */
  -webkit-touch-action: auto;
  touch-action: auto;
}

/* 必须单独覆盖：上面这条带 id 的规则设了 display:flex，
   优先级高于 .ab-app .ab-hidden 的 display:none，否则藏不住 */
#ab-bible-credits-panel.ab-hidden {
  display: none;
}

#ab-bible-credits-card {
  width: 100%;
  max-width: 340px;
  max-height: 100%;
  overflow-y: auto;
  padding: 22px 20px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.7);
  text-align: left;
  font-size: 13px;
  line-height: 1.6;
  cursor: default;
  -webkit-overscroll-behavior: contain;
  overscroll-behavior: contain;
}

/* 允许选中/复制署名文字（.ab-app * 默认全部禁选） */
#ab-bible-credits-card,
#ab-bible-credits-card * {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

#ab-bible-credits-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 14px;
}

#ab-bible-credits-card p {
  margin-bottom: 12px;
}

#ab-bible-credits-card a {
  color: #f0c987;
  text-decoration: underline;
  text-underline-offset: 2px;
  /* 优先按空格/连字符换行，仅超长无空格 URL 才拆词，避免 "incompetech.com" 被切碎 */
  overflow-wrap: break-word;
  word-wrap: break-word;
  cursor: pointer;
}

#ab-bible-credits-card a:active {
  color: #fff;
}

#ab-bible-credits-close {
  display: block;
  margin: 18px auto 0;
  padding: 8px 26px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 6px;
  cursor: pointer;
}

#ab-bible-credits-close:active {
  background: rgba(255, 255, 255, 0.22);
}
