#app-books {
  background: #f2f2f7;
  color: #111111;
  font-family: var(--app-font, -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif);
  font-size: var(--app-font-size, 15px);
}

.bk-shell {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 顶部单行导航：[ < ] 主页（非主页隐藏返回键） */
.bk-header {
  padding: calc(env(safe-area-inset-top) + 10px) 18px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 5;
}

.bk-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bk-back {
  flex-shrink: 0;
}

.bk-shell.is-subtab .bk-back {
  display: none;
}

.bk-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #111111;
  line-height: 1.15;
}

.bk-import-btn {
  padding: 7px 13px;
  border-radius: 999px;
  background: #ffffff;
  color: #111111;
  font-size: calc(var(--app-font-size, 15px) - 2px);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  display: none;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.bk-import-btn.show {
  display: inline-flex;
}

.bk-import-btn svg {
  width: 14px;
  height: 14px;
  stroke: #111111;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
}

/* 主内容滚动区 */
.bk-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 16px 110px;
}

.bk-panel {
  display: none;
}

.bk-panel.active {
  display: block;
}

/* 立体书架：最小 中 大 中 最小 */
.bk-shelf-wrap {
  margin-top: 10px;
  margin-bottom: 26px;
  touch-action: pan-y;
}

.bk-shelf-row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  padding: 8px 4px 0;
  position: relative;
  z-index: 2;
}

.bk-book-slot {
  position: relative;
  cursor: pointer;
  transform-origin: bottom center;
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
}

.bk-book-slot.is-xs {
  flex: 0.78;
  max-width: 44px;
  opacity: 0.86;
}

.bk-book-slot.is-md {
  flex: 1.08;
  max-width: 62px;
  opacity: 0.96;
}

.bk-book-slot.is-lg {
  flex: 1.72;
  max-width: 100px;
  opacity: 1;
  z-index: 3;
}

/* 立体书封面（无侧边白条，纯投影立体感） */
.bk-cover-3d {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 3px 6px 6px 3px;
  background-color: #e5e5ea;
  overflow: hidden;
  box-shadow:
    0 10px 18px -6px rgba(0, 0, 0, 0.34),
    0 4px 6px -2px rgba(0, 0, 0, 0.16);
}

.bk-book-slot.is-xs .bk-cover-3d {
  box-shadow: 0 6px 12px -5px rgba(0, 0, 0, 0.24);
}

.bk-cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.22s ease;
  z-index: 1;
}

.bk-cover-3d.has-cover .bk-cover-img {
  opacity: 1;
}

/* 左侧书脊压痕与高光 */
.bk-cover-3d::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.28) 0%,
    rgba(0, 0, 0, 0.22) 4%,
    rgba(255, 255, 255, 0.18) 7%,
    rgba(0, 0, 0, 0.04) 11%,
    transparent 18%,
    rgba(0, 0, 0, 0.08) 100%
  );
  pointer-events: none;
  z-index: 3;
}

/* 无图或加载失败时的极简兜底排版封面 */
.bk-cover-fallback {
  position: absolute;
  inset: 0;
  padding: 9px 7px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(155deg, #ffffff 0%, #e9e9ee 100%);
  color: #1c1c1e;
  z-index: 2;
  transition: opacity 0.2s ease;
}

.bk-cover-3d.has-cover .bk-cover-fallback {
  opacity: 0;
  pointer-events: none;
}

.bk-fb-title {
  font-size: 10px;
  font-weight: 700;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bk-book-slot.is-lg .bk-fb-title {
  font-size: 13px;
}

.bk-fb-author {
  font-size: 8px;
  color: #6e6e73;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 书架横板 */
.bk-shelf-ledge {
  position: relative;
  height: 12px;
  margin-top: -2px;
  border-radius: 6px;
  background: linear-gradient(180deg, #ffffff 0%, #e8e8ed 55%, #d6d6dc 100%);
  box-shadow:
    0 8px 16px rgba(0, 0, 0, 0.09),
    0 2px 4px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  z-index: 1;
}

/* 阅读目标区域（p1） */
.bk-goal-card {
  background: #ffffff;
  border-radius: 24px;
  padding: 24px 20px 22px;
  text-align: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
}

.bk-goal-heading {
  font-size: calc(var(--app-font-size, 15px) + 5px);
  font-weight: 700;
  color: #111111;
  margin-bottom: 6px;
}

.bk-goal-desc {
  font-size: calc(var(--app-font-size, 15px) - 3px);
  color: #8e8e93;
  line-height: 1.45;
  max-width: 260px;
  margin: 0 auto 14px;
}

.bk-arc-box {
  position: relative;
  width: 250px;
  height: 148px;
  margin: 0 auto 16px;
}

.bk-arc-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.bk-arc-inner {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.bk-arc-label {
  font-size: calc(var(--app-font-size, 15px) - 2px);
  font-weight: 600;
  color: #111111;
  margin-bottom: 2px;
}

.bk-arc-time {
  font-size: 46px;
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1.05;
  color: #111111;
  font-variant-numeric: tabular-nums;
}

.bk-arc-target-btn {
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: calc(var(--app-font-size, 15px) - 2px);
  color: #3a3a3c;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 999px;
}

.bk-arc-target-btn:active {
  background: rgba(0, 0, 0, 0.05);
}

.bk-arc-target-btn svg {
  width: 13px;
  height: 13px;
  stroke: #8e8e93;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bk-continue-btn {
  width: 100%;
  padding: 13px 20px;
  border-radius: 999px;
  background: #111111;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.bk-continue-btn:active {
  transform: scale(0.98);
  opacity: 0.9;
}

.bk-continue-main {
  font-size: var(--app-font-size, 15px);
  font-weight: 600;
}

.bk-continue-sub {
  font-size: calc(var(--app-font-size, 15px) - 3px);
  color: rgba(255, 255, 255, 0.72);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.2s ease;
}

/* 书库 Tab：一行一张独立白卡，书名紧贴封面上缘，进度在左下，三点在右下 */
.bk-lib-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 4px;
}

.bk-lib-card {
  background: #ffffff;
  border-radius: 20px;
  padding: 12px 14px;
  display: flex;
  align-items: stretch;
  gap: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.bk-lib-card:active {
  transform: scale(0.985);
}

.bk-lib-thumb {
  width: 52px;
  flex-shrink: 0;
}

.bk-lib-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1px 0 0;
}

.bk-lib-top {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.bk-lib-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bk-lib-name {
  font-size: var(--app-font-size, 15px);
  font-weight: 600;
  color: #111111;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bk-lib-badge {
  flex-shrink: 0;
  padding: 1px 7px;
  border-radius: 999px;
  background: #111111;
  color: #ffffff;
  font-size: 10px;
  font-weight: 600;
}

.bk-lib-author {
  font-size: calc(var(--app-font-size, 15px) - 3px);
  color: #8e8e93;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bk-lib-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.bk-lib-progress {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.bk-lib-bar {
  flex: 1;
  max-width: 110px;
  height: 3px;
  border-radius: 999px;
  background: #e5e5ea;
  overflow: hidden;
}

.bk-lib-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: #111111;
}

.bk-lib-pct {
  font-size: calc(var(--app-font-size, 15px) - 4px);
  color: #8e8e93;
  font-variant-numeric: tabular-nums;
}

.bk-lib-more {
  width: 28px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  cursor: pointer;
}

.bk-lib-more svg {
  width: 18px;
  height: 18px;
  fill: #48484a;
}

/* 统计 Tab */
.bk-stats-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 4px;
}

.bk-stats-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.bk-stat-kpi {
  background: #ffffff;
  border-radius: 24px;
  padding: 18px 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.bk-stat-kpi-label {
  font-size: calc(var(--app-font-size, 15px) - 3px);
  color: #8e8e93;
  font-weight: 600;
  margin-bottom: 8px;
}

.bk-stat-kpi-val {
  font-size: 26px;
  font-weight: 700;
  color: #111111;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.bk-stat-kpi-sub {
  font-size: calc(var(--app-font-size, 15px) - 4px);
  color: #6e6e73;
  margin-top: 6px;
}

.bk-chart-card {
  background: #ffffff;
  border-radius: 24px;
  padding: 20px 18px 18px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.bk-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.bk-chart-title {
  font-size: calc(var(--app-font-size, 15px) + 1px);
  font-weight: 700;
  color: #111111;
}

.bk-chart-pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: #f2f2f7;
  font-size: calc(var(--app-font-size, 15px) - 3px);
  font-weight: 600;
  color: #3a3a3c;
}

.bk-chart-area {
  position: relative;
  height: 136px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding-top: 16px;
}

.bk-chart-goal-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1.5px dashed #d1d1d6;
  pointer-events: none;
  z-index: 1;
}

.bk-chart-goal-tag {
  position: absolute;
  right: 0;
  top: -17px;
  font-size: 10px;
  color: #8e8e93;
  background: #ffffff;
  padding-left: 4px;
}

.bk-bar-col {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  z-index: 2;
}

.bk-bar-track {
  width: 100%;
  max-width: 24px;
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.bk-bar-fill {
  width: 100%;
  min-height: 4px;
  border-radius: 6px;
  background: #e5e5ea;
  transition: height 0.35s ease;
}

.bk-bar-col.is-today .bk-bar-fill {
  background: #111111;
}

.bk-bar-col.has-val:not(.is-today) .bk-bar-fill {
  background: #8e8e93;
}

.bk-bar-day {
  font-size: calc(var(--app-font-size, 15px) - 4px);
  color: #8e8e93;
  font-weight: 600;
}

.bk-bar-col.is-today .bk-bar-day {
  color: #111111;
}

.bk-habit-card {
  background: #ffffff;
  border-radius: 24px;
  padding: 6px 18px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.bk-habit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid #f2f2f7;
}

.bk-habit-row:last-child {
  border-bottom: none;
}

.bk-habit-label {
  font-size: var(--app-font-size, 15px);
  color: #111111;
  font-weight: 500;
}

.bk-habit-val {
  font-size: var(--app-font-size, 15px);
  color: #6e6e73;
  font-weight: 600;
}

/* 笔记占位页 */
.bk-notes-empty {
  background: #ffffff;
  border-radius: 24px;
  padding: 46px 24px;
  text-align: center;
  margin-top: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.bk-notes-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: #f2f2f7;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bk-notes-icon svg {
  width: 20px;
  height: 20px;
  stroke: #111111;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bk-notes-title {
  font-size: calc(var(--app-font-size, 15px) + 1px);
  font-weight: 700;
  margin-bottom: 6px;
}

.bk-notes-sub {
  font-size: calc(var(--app-font-size, 15px) - 3px);
  color: #8e8e93;
}

/* 底部 4 格液态玻璃胶囊 */
#app-books .bk-bottom-bar {
  position: absolute;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 18px);
  transform: translateX(-50%);
  width: 300px;
  height: 52px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  padding: 4px;
  z-index: 20;
}

#app-books .bk-tab-indicator {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(25% - 2px);
  height: calc(100% - 8px);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  pointer-events: none;
}

#app-books .bk-tab {
  position: relative;
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--app-font-size, 15px) - 1px);
  font-weight: 600;
  color: #6e6e73;
  cursor: pointer;
  z-index: 2;
  transition: color 0.2s ease;
}

#app-books .bk-tab.active {
  color: #111111;
}

/* p2 阅读目标全屏详情弹窗 */
.bk-goal-modal {
  position: absolute;
  inset: 0;
  background: #ffffff;
  z-index: 40;
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 14px) 24px calc(env(safe-area-inset-bottom) + 28px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(24px);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.bk-goal-modal.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.bk-goal-modal-top {
  display: flex;
  justify-content: flex-end;
}

.bk-close-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f2f2f7;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.bk-close-circle svg {
  width: 16px;
  height: 16px;
  stroke: #111111;
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
}

.bk-goal-modal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.bk-goal-divider {
  width: 100%;
  height: 1px;
  background: #e5e5ea;
  margin: 26px 0;
}

.bk-modal-stat-title {
  font-size: calc(var(--app-font-size, 15px) + 2px);
  font-weight: 700;
  color: #111111;
}

.bk-modal-stat-blue {
  font-size: calc(var(--app-font-size, 15px) + 3px);
  font-weight: 700;
  color: #007aff;
  margin: 6px 0;
}

.bk-modal-stat-sub {
  font-size: calc(var(--app-font-size, 15px) - 3px);
  color: #3a3a3c;
}

.bk-goal-modal-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.bk-share-btn {
  width: 220px;
  height: 48px;
  border-radius: 999px;
  background: #111111;
  color: #ffffff;
  font-size: var(--app-font-size, 15px);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.bk-adjust-btn {
  font-size: calc(var(--app-font-size, 15px) - 1px);
  font-weight: 600;
  color: #111111;
  padding: 6px 14px;
  cursor: pointer;
}

/* 居中弹窗 */
.bk-center-modal {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.bk-center-modal.open {
  display: flex;
}

.bk-dialog {
  position: relative;
  width: 100%;
  max-width: 310px;
  background: #ffffff;
  border-radius: 24px;
  padding: 22px 20px 20px;
  text-align: center;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

.bk-dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f2f2f7;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.bk-dialog-close svg {
  width: 13px;
  height: 13px;
  stroke: #111111;
  fill: none;
  stroke-width: 2.3;
  stroke-linecap: round;
}

.bk-dialog-title {
  font-size: calc(var(--app-font-size, 15px) + 2px);
  font-weight: 700;
  margin-bottom: 16px;
}

.bk-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 16px;
}

.bk-step-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f2f2f7;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.bk-step-btn svg {
  width: 16px;
  height: 16px;
  stroke: #111111;
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
}

.bk-step-val {
  font-size: 28px;
  font-weight: 700;
  min-width: 96px;
  font-variant-numeric: tabular-nums;
}

.bk-presets {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 18px;
}

.bk-preset-chip {
  padding: 6px 12px;
  border-radius: 999px;
  background: #f2f2f7;
  font-size: calc(var(--app-font-size, 15px) - 2px);
  font-weight: 600;
  color: #3a3a3c;
  cursor: pointer;
}

.bk-preset-chip.active {
  background: #111111;
  color: #ffffff;
}

.bk-save-btn {
  width: 100%;
  height: 44px;
  border-radius: 999px;
  background: #111111;
  color: #ffffff;
  font-size: var(--app-font-size, 15px);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.bk-menu-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bk-menu-btn {
  width: 100%;
  height: 44px;
  border-radius: 14px;
  background: #f2f2f7;
  color: #111111;
  font-size: var(--app-font-size, 15px);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.bk-menu-btn:active {
  opacity: 0.8;
}

/* 轻量提示条 */
.bk-toast {
  position: absolute;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 84px);
  transform: translateX(-50%) translateY(10px);
  background: rgba(17, 17, 17, 0.88);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: calc(var(--app-font-size, 15px) - 2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 80;
  white-space: nowrap;
}

.bk-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}