/* ==========================================================================
   古籍数字阅读器 - 典雅木纹与现代高端控件 CSS 内核
   ========================================================================== */

/* 全局基调与字体 */
body.reader-body {
  margin: 0;
  padding: 0;
  height: 100vh;
  height: 100dvh;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  background-color: #f4ebd0;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  font-family: -apple-system, BlinkMacSystemFont, "Noto Serif SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", serif;
}

/* 顶部导览栏 Header Container */
.reader-toolbar {
  height: 56px;
  background: linear-gradient(180deg, #2a2520 0%, #1c1815 100%);
  color: #f6f2e9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 100;
  box-sizing: border-box;
  gap: 16px;
}

/* 左侧区域：返回按钮 + 书名 */
.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex-shrink: 1;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #d4c5b3;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-back:hover {
  background: #8c2425;
  border-color: #aa3436;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(140, 36, 37, 0.4);
}

.reader-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: #e8d7c3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

.reader-title .book-icon {
  font-size: 16px;
  opacity: 0.9;
}

.reader-title .title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.5px;
}

/* 中间区域：翻页控制器 */
.toolbar-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pagination-group {
  display: inline-flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 3px;
  gap: 4px;
}

.page-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: #e5d8ca;
  border: none;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.page-nav-btn:hover {
  background: #8c2425;
  color: #ffffff;
}

.page-nav-btn:active {
  transform: scale(0.97);
}

.page-input-wrapper {
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  gap: 6px;
}

.page-input-wrapper input[type="number"] {
  width: 48px;
  height: 28px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: #ffffff;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.2s;
  -moz-appearance: textfield;
}

.page-input-wrapper input[type="number"]::-webkit-outer-spin-button,
.page-input-wrapper input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.page-input-wrapper input[type="number"]:focus {
  border-color: #d4a76a;
  box-shadow: 0 0 0 2px rgba(212, 167, 106, 0.25);
}

.page-total {
  font-size: 13px;
  color: #a89a8c;
  white-space: nowrap;
}

/* 右侧区域：下拉选框与按钮 */
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.toolbar-divider {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 4px;
}

/* 下拉框自定义 */
.select-wrapper {
  position: relative;
  display: inline-block;
}

.custom-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: rgba(255, 255, 255, 0.08);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23d4c5b3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  color: #f0e6da;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 6px 30px 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.custom-select:hover {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
}

.custom-select option {
  background-color: #231f1c;
  color: #f6f2e9;
  padding: 8px;
}

/* 按钮组 */
.btn-group {
  display: inline-flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 28px;
  background: transparent;
  color: #d4c5b3;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.icon-btn:active {
  transform: scale(0.94);
}

.highlight-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  width: 34px;
  height: 32px;
}

.highlight-btn:hover {
  background: #8c2425;
  border-color: #aa3436;
  color: #ffffff;
}

/* 主题护眼样式 Classes */
body.theme-yellow { background-color: #f4ebd0; }
body.theme-white  { background-color: #f8fafc; }
body.theme-dark   { background-color: #12100e; color: #ccc; }

/* 主视口 Viewer Viewport Container */
.reader-viewport {
  flex: 1;
  height: calc(100vh - 56px);
  height: calc(100dvh - 56px);
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.page-wrapper {
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 380px;
  min-height: 520px;
  max-height: calc(100vh - 96px);
  max-width: 100%;
  box-shadow: 0 12px 40px rgba(42, 35, 30, 0.25);
  background: #fbf7ed;
  background-image: radial-gradient(#e8ddc8 1px, transparent 1px);
  background-size: 16px 16px;
  border: 1px solid #e2d7c3;
  border-radius: 4px;
  overflow: hidden;
  transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.page-img, .page-canvas {
  display: block;
  pointer-events: none;
  user-select: none;
  background-color: #fbf7ed;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* 排版模式 - 双叶 / 单叶 CSS */
.layout-single #page-canvas-right, .layout-single #book-spine {
  display: none !important;
}
.layout-single #page-canvas-left {
  display: block !important;
}

.layout-double-rtl #page-canvas-left,
.layout-double-rtl #page-canvas-right,
.layout-double-ltr #page-canvas-left,
.layout-double-ltr #page-canvas-right {
  display: block !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.layout-double-rtl #book-spine,
.layout-double-ltr #book-spine {
  display: block !important;
  width: 8px;
  background: linear-gradient(to right, rgba(0,0,0,0.4), rgba(0,0,0,0.05) 50%, rgba(0,0,0,0.4));
  box-shadow: inset 0 0 6px rgba(0,0,0,0.6);
  align-self: stretch;
  z-index: 5;
  flex-shrink: 0;
}

/* 传统古籍右开本 (右到左 - RTL) */
body.layout-double-rtl .page-wrapper {
  display: inline-flex !important;
  flex-direction: row-reverse !important;
  align-items: center;
  justify-content: center;
  background: #231f1a;
  padding: 6px;
  border-radius: 4px;
}

/* 现代开本 (左到右 - LTR) */
body.layout-double-ltr .page-wrapper {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center;
  justify-content: center;
  background: #231f1a;
  padding: 6px;
  border-radius: 4px;
}

body.layout-double-rtl.mode-contain .page-canvas,
body.layout-double-ltr.mode-contain .page-canvas {
  max-height: calc(100vh - 96px);
  max-width: 46vw;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* 适合模式控制 */
.mode-contain .page-wrapper {
  max-height: calc(100vh - 96px);
  max-width: 100%;
}
.mode-contain .page-canvas {
  max-height: calc(100vh - 96px);
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.mode-width .page-wrapper {
  max-height: none;
  max-width: 95%;
  width: 95%;
}
.mode-width .page-canvas {
  max-height: none;
  max-width: 100%;
  width: 100%;
  height: auto;
}

.mode-actual .page-wrapper {
  max-height: none;
  max-width: none;
}
.mode-actual .page-canvas {
  max-height: none;
  max-width: none;
  width: auto;
  height: auto;
}

.watermark-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  align-content: space-around;
  overflow: hidden;
  opacity: 0.25;
}

.watermark-item {
  flex: 1 0 220px;
  max-width: 320px;
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-25deg);
  font-size: 18px;
  color: #787878;
  font-weight: bold;
  white-space: nowrap;
}

/* 水印排列密度样式 */
.watermark-density-sparse .watermark-item {
  flex: 1 0 300px;
  max-width: 420px;
  height: 180px;
}
.watermark-density-medium .watermark-item {
  flex: 1 0 220px;
  max-width: 320px;
  height: 130px;
}
.watermark-density-dense .watermark-item {
  flex: 1 0 140px;
  max-width: 200px;
  height: 85px;
}

/* 非阻塞轻量化古风加载提示悬浮条 */
.reader-loading-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #e2d7c3;
  box-shadow: 0 8px 24px rgba(139, 29, 29, 0.12);
  padding: 10px 22px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #8b1d1d;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  backdrop-filter: blur(4px);
  white-space: nowrap;
}

.reader-loading-badge.hidden {
  opacity: 0;
  visibility: hidden;
}

.reader-loading-badge .spin-icon {
  font-size: 16px;
  display: inline-block;
  animation: pulseIcon 1.2s infinite ease-in-out;
}

@keyframes pulseIcon {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

/* 缩略图抽屉 Drawer */
.thumbnail-drawer {
  position: fixed;
  bottom: -320px;
  left: 0;
  right: 0;
  height: 280px;
  background: #231f1c;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.5);
  z-index: 99;
  transition: bottom 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.thumbnail-drawer.active {
  bottom: 0;
}

.drawer-header {
  height: 40px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #e5d8c6;
  font-size: 13px;
  font-weight: 600;
}

.drawer-close-btn {
  background: transparent;
  border: none;
  color: #a89885;
  font-size: 20px;
  cursor: pointer;
}

.thumbnail-grid {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 12px 16px;
  display: flex;
  gap: 16px;
  align-items: center;
}

.thumb-card {
  flex: 0 0 110px;
  height: 175px;
  background: #1a1715;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  position: relative;
  transition: all 0.2s ease;
  overflow: hidden;
  padding: 4px;
}

.thumb-card canvas {
  width: 100%;
  height: 145px;
  object-fit: contain;
  border-radius: 4px;
  background: #282420;
}

.thumb-card:hover {
  border-color: #8b1d1d;
  transform: translateY(-2px);
}

.thumb-card.active {
  border-color: #d4a359;
  box-shadow: 0 0 12px rgba(212, 163, 89, 0.4);
}

.thumb-card span {
  font-size: 11px;
  color: #d4c5b3;
  padding-bottom: 2px;
}

/* 关联书签弹窗 Modal */
.bookmark-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bookmark-modal .modal-content {
  width: 440px;
  max-width: 90vw;
  background: #282420;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.bookmark-modal .modal-header {
  padding: 14px 20px;
  background: #201c19;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #f0e6da;
  font-size: 15px;
  font-weight: 600;
}

.bookmark-modal .modal-body {
  padding: 16px 20px;
}

.btn-bookmark-action {
  width: 100%;
  padding: 10px;
  background: #8b1d1d;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-bookmark-action:hover {
  background: #a32424;
}

.bookmark-list {
  margin-top: 14px;
  max-height: 240px;
  overflow-y: auto;
}

.bookmark-item {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #d4c5b3;
  font-size: 13px;
  cursor: pointer;
}

.bookmark-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* 研学笔记与朱批圈点 CSS */
.study-modal-large {
  width: 640px !important;
  max-width: 92vw !important;
  background: #1e1b18 !important;
}
.quota-badge {
  font-size: 11.5px;
  background: rgba(255,255,255,0.1);
  padding: 2px 8px;
  border-radius: 10px;
  color: #fbbf24;
}
.quota-bar-wrapper {
  height: 4px;
  background: rgba(255,255,255,0.1);
  width: 100%;
}
.quota-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #8b1d1d);
  transition: width 0.3s ease;
}
.btn-primary-sub {
  background: #8b1d1d;
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
}
.btn-primary-sub:hover { background: #a32424; }
.btn-secondary-sub {
  background: rgba(255,255,255,0.1);
  color: #e2e8f0;
  border: 1px solid rgba(255,255,255,0.2);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}
.btn-secondary-sub:hover { background: rgba(255,255,255,0.2); }

.export-btn-group .btn-export-link {
  display: inline-block;
  background: rgba(255,255,255,0.08);
  color: #cbd5e1;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11.5px;
  margin-left: 3px;
  text-decoration: none;
}
.export-btn-group .btn-export-link:hover {
  background: #8b1d1d;
  color: #fff;
}

.note-form-card {
  background: #282420;
  border: 1px solid rgba(255,255,255,0.12);
  padding: 14px;
  border-radius: 6px;
  margin-bottom: 14px;
}
.form-label-sub {
  display: block;
  font-size: 11.5px;
  color: #94a3b8;
  margin-bottom: 4px;
}
.form-control-sub {
  width: 100%;
  background: #181512;
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 13px;
  box-sizing: border-box;
}
.form-control-sub:focus {
  outline: none;
  border-color: #8b1d1d;
}

.btn-save-sub {
  background: #8b1d1d;
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12.5px;
}
.btn-cancel-sub {
  background: transparent;
  color: #94a3b8;
  border: none;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12.5px;
  margin-right: 6px;
}

.note-tab-header {
  display: flex;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 12px;
}
.note-tab-btn {
  background: none;
  border: none;
  color: #94a3b8;
  padding: 6px 4px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.note-tab-btn.active {
  color: #f0e6da;
  border-bottom-color: #8b1d1d;
  font-weight: 600;
}

.study-notes-list {
  max-height: 280px;
  overflow-y: auto;
}
.study-note-item {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 10px;
}
.study-note-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.study-note-tag {
  background: #8b1d1d;
  color: #fff;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 3px;
  margin-right: 6px;
}
.study-note-title {
  color: #f1f5f9;
  font-weight: 600;
  font-size: 13.5px;
}
.study-note-body {
  color: #cbd5e1;
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* 所见即所得朱批悬浮工具栏 (固定悬浮于屏幕顶部) */
.ink-float-toolbar {
  position: fixed !important;
  top: 60px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  background: rgba(32, 28, 25, 0.95) !important;
  border: 1px solid rgba(226, 215, 195, 0.3) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6) !important;
  padding: 8px 20px !important;
  border-radius: 30px !important;
  display: none !important;
  align-items: center !important;
  gap: 10px !important;
  z-index: 9990 !important;
  backdrop-filter: blur(10px) !important;
}
.ink-float-toolbar.active {
  display: flex !important;
}

.ink-tool-btn {
  width: 26px !important;
  height: 26px !important;
  border-radius: 50% !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  background: rgba(255, 255, 255, 0.08) !important;
  color: #f0e6da !important;
  font-size: 12px !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.15s ease !important;
  box-sizing: border-box !important;
  padding: 0 !important;
}
.ink-tool-btn:hover {
  background: rgba(255, 255, 255, 0.25) !important;
  transform: scale(1.15) !important;
}
.ink-tool-btn.active {
  background: #8b1d1d !important;
  color: #fff !important;
  border-color: #fca5a5 !important;
  box-shadow: 0 0 0 2px rgba(139, 29, 29, 0.4) !important;
}

.ink-color-picker-single {
  width: 24px !important;
  height: 24px !important;
  padding: 0 !important;
  border: 2px solid #ffffff !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  background: none !important;
  box-sizing: border-box !important;
  outline: none !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.6) !important;
  transition: transform 0.15s ease !important;
}
.ink-color-picker-single:hover {
  transform: scale(1.15) !important;
}
.ink-color-picker-single::-webkit-color-swatch-wrapper { padding: 0 !important; }
.ink-color-picker-single::-webkit-color-swatch { border: none !important; border-radius: 50% !important; }
.ink-color-picker-single::-moz-color-swatch { border: none !important; border-radius: 50% !important; }

.ink-size-num {
  width: 38px !important;
  height: 22px !important;
  background: rgba(255, 255, 255, 0.12) !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  border-radius: 4px !important;
  color: #ffffff !important;
  font-size: 11.5px !important;
  font-weight: 600 !important;
  text-align: center !important;
  outline: none !important;
  padding: 0 2px !important;
  box-sizing: border-box !important;
}
.ink-size-num:focus {
  border-color: #f87171 !important;
  background: rgba(255, 255, 255, 0.25) !important;
}

.ink-color-btn {
  width: 22px !important;
  height: 22px !important;
  border-radius: 50% !important;
  border: 2px solid transparent !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: transform 0.15s ease !important;
  box-sizing: border-box !important;
}
.ink-color-btn:hover { transform: scale(1.15) !important; }
.ink-color-btn.active {
  border-color: #fff !important;
  box-shadow: 0 0 0 2px #8b1d1d !important;
}
.ink-divider { width: 1px !important; height: 18px !important; background: rgba(255,255,255,0.2) !important; }
.btn-ink-sub {
  background: rgba(255,255,255,0.15) !important;
  color: #f0e6da !important;
  border: none !important;
  width: 26px !important;
  height: 26px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  font-size: 13px !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.15s ease !important;
}
.btn-ink-sub:hover {
  background: #8b1d1d !important;
  color: #fff !important;
  transform: scale(1.15) !important;
}
#btn-ink-close {
  background: rgba(239, 68, 68, 0.25) !important;
  color: #fca5a5 !important;
}
#btn-ink-close:hover {
  background: #dc2626 !important;
  color: #fff !important;
}

/* 划框截图提示浮层 */
.crop-hint-badge {
  position: fixed !important;
  top: 60px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  background: #8b1d1d !important;
  color: #fff !important;
  padding: 10px 22px !important;
  border-radius: 30px !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  z-index: 9995 !important;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6) !important;
  display: none;
}
.crop-hint-badge.active {
  display: flex !important;
}

/* 去水印商业授权 Modal 弹窗 */
.reader-modal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 99999 !important;
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
}
.reader-modal.active {
  display: flex !important;
}
.reader-modal-overlay {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: rgba(0, 0, 0, 0.65) !important;
  backdrop-filter: blur(4px) !important;
}
.reader-modal-card {
  position: relative !important;
  z-index: 2 !important;
  width: 480px !important;
  max-width: 90vw !important;
  background: #1e1b18 !important;
  border: 1px solid rgba(226, 215, 195, 0.25) !important;
  border-radius: 14px !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8) !important;
  color: #f0e6da !important;
  overflow: hidden !important;
}
.reader-modal-header {
  padding: 16px 20px !important;
  background: rgba(255, 255, 255, 0.05) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
}
.reader-modal-header h3 {
  margin: 0 !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  color: #f59e0b !important;
}
.modal-close-btn {
  background: transparent !important;
  border: none !important;
  color: #94a3b8 !important;
  font-size: 22px !important;
  cursor: pointer !important;
  line-height: 1 !important;
}
.modal-close-btn:hover { color: #fff !important; }
.reader-modal-body {
  padding: 20px !important;
}
.wm-points-badge {
  background: rgba(255, 255, 255, 0.06) !important;
  padding: 10px 14px !important;
  border-radius: 8px !important;
  font-size: 13px !important;
  color: #cbd5e1 !important;
  margin-bottom: 16px !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
}
.wm-option-card {
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 10px !important;
  padding: 14px 16px !important;
  margin-bottom: 12px !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 12px !important;
}
.wm-option-card.highlight {
  background: rgba(245, 158, 11, 0.08) !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
}
.wm-option-info h4 {
  margin: 0 0 4px 0 !important;
  font-size: 14px !important;
  color: #f8fafc !important;
}
.wm-option-info p {
  margin: 0 !important;
  font-size: 12px !important;
  color: #94a3b8 !important;
  line-height: 1.4 !important;
}
.wm-option-action {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-end !important;
  gap: 6px !important;
}
.wm-price {
  font-size: 18px !important;
  font-weight: 700 !important;
  color: #f59e0b !important;
}
.wm-price small {
  font-size: 11px !important;
  font-weight: normal !important;
  color: #94a3b8 !important;
}
.btn-wm-action {
  background: #3b82f6 !important;
  color: #fff !important;
  border: none !important;
  padding: 6px 14px !important;
  border-radius: 6px !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  white-space: nowrap !important;
}
.btn-wm-action:hover { background: #2563eb !important; }
.btn-wm-action.btn-gold {
  background: linear-gradient(135deg, #d97706, #b45309) !important;
  color: #fff !important;
}
.btn-wm-action.btn-gold:hover {
  background: linear-gradient(135deg, #b45309, #92400e) !important;
}
.btn-wm-action:disabled {
  background: #475569 !important;
  color: #94a3b8 !important;
  cursor: not-allowed !important;
}
.wm-notice-tips {
  font-size: 11.5px !important;
  color: #64748b !important;
  line-height: 1.5 !important;
  margin-top: 14px !important;
}

/* 移动端底部控制栏默认在桌面端隐藏 */
.mobile-bottom-bar {
  display: none !important;
}

/* ==========================================================================
   移动端响应式极致优化 CSS (iOS / Android 移动原生体验)
   ========================================================================== */
@media (max-width: 900px) {
  /* 顶部导航栏收缩 */
  .reader-toolbar {
    height: 48px;
    padding: 0 10px;
    gap: 8px;
  }

  .btn-back span {
    display: none;
  }

  .btn-back {
    padding: 5px 8px;
  }

  .toolbar-left .toolbar-divider {
    display: none;
  }

  .reader-title {
    max-width: 140px;
    font-size: 13.5px;
  }

  /* 隐藏桌面端顶部控制 */
  .toolbar-center {
    display: none !important;
  }

  .toolbar-right .select-wrapper,
  .toolbar-right .btn-group,
  .toolbar-right .toolbar-divider,
  .toolbar-right #btn-ink-mode,
  .toolbar-right #btn-crop-mode,
  .toolbar-right #btn-study-notes,
  .toolbar-right #btn-watermark-unlock {
    display: none !important;
  }

  .toolbar-right {
    gap: 6px;
  }

  /* 主视口高度调优 (扣除顶部 48px + 底部 56px 控制栏及 iOS 安全边距) */
  .reader-viewport {
    height: calc(100vh - 104px - env(safe-area-inset-bottom, 0px)) !important;
    height: calc(100dvh - 104px - env(safe-area-inset-bottom, 0px)) !important;
    padding: 8px !important;
    touch-action: none !important;
  }

  .mode-contain .page-wrapper,
  .mode-contain .page-canvas {
    max-height: calc(100vh - 120px - env(safe-area-inset-bottom, 0px)) !important;
  }

  /* 移动端底部吸底浮动控制栏 */
  .mobile-bottom-bar {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: calc(56px + env(safe-area-inset-bottom, 0px)) !important;
    background: linear-gradient(180deg, rgba(28,24,21,0.95) 0%, rgba(18,16,14,0.99) 100%) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.15) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-around !important;
    padding: 0 12px env(safe-area-inset-bottom, 0px) 12px !important;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.5) !important;
    z-index: 9999 !important;
    box-sizing: border-box !important;
    touch-action: none !important;
    -webkit-transform: translate3d(0, 0, 0) !important;
    transform: translate3d(0, 0, 0) !important;
    will-change: transform;
  }

  .m-nav-btn {
    background: rgba(255, 255, 255, 0.12);
    color: #f6f2e9;
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 7px 15px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }

  .m-nav-btn:active {
    background: #8b1d1d;
    transform: scale(0.95);
  }

  .m-nav-btn.icon-only {
    padding: 7px 11px;
    font-size: 16px;
    border-radius: 50%;
  }

  .m-page-indicator {
    font-size: 13.5px;
    color: #e2d7c3;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.4);
    padding: 4px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
  }

  /* 移动端研选工具弹板 Bottom Sheet Modal */
  .mobile-tools-modal.active {
    display: flex !important;
    z-index: 999999 !important;
  }

  .mobile-tools-card {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 16px 16px 0 0 !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: #231f1c !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.6) !important;
    padding: 20px 18px calc(28px + env(safe-area-inset-bottom, 0px)) 18px !important;
    box-sizing: border-box !important;
    max-height: 80vh !important;
    overflow-y: auto !important;
    animation: slideUpSheet 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  @keyframes slideUpSheet {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .mobile-tools-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    color: #f6f2e9;
    font-size: 15px;
    font-weight: 700;
  }

  .m-tool-section {
    margin-top: 16px;
  }

  .m-tool-section label {
    display: block;
    font-size: 12.5px;
    color: #d5c4a5;
    margin-bottom: 8px;
    font-weight: 600;
  }

  .m-btn-tabs {
    display: flex;
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    padding: 3px;
    gap: 4px;
  }

  .m-btn-tabs button {
    flex: 1;
    background: transparent;
    color: #a0aec0;
    border: none;
    padding: 7px 4px;
    border-radius: 6px;
    font-size: 12.5px;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .m-btn-tabs button.active {
    background: #8b1d1d;
    color: #ffffff;
    font-weight: 600;
  }

  .m-action-btn {
    flex: 1;
    background: rgba(255,255,255,0.08);
    color: #e2e8f0;
    border: 1px solid rgba(255,255,255,0.12);
    padding: 8px;
    border-radius: 6px;
    font-size: 12.5px;
    cursor: pointer;
  }
  .m-action-btn:active {
    background: #8b1d1d;
  }

  .m-grid-tools {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .m-grid-btn {
    background: rgba(255,255,255,0.06);
    color: #e2e8f0;
    border: 1px solid rgba(255,255,255,0.12);
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
  }

  .m-grid-btn:active {
    background: #8b1d1d;
    color: #fff;
  }
}

