/* 电子画册平台 — 全局样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --accent: #2e5395;
  --accent-2: #3b5bfd;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #7a8194;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(31, 51, 96, .10);
}
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 28px; color: #fff;
  background: linear-gradient(120deg, #1f3864 0%, #2e5395 55%, #3b5bfd 100%);
  box-shadow: 0 4px 18px rgba(31, 56, 100, .25);
  position: sticky; top: 0; z-index: 50;
}
.topbar .brand { font-size: 19px; font-weight: 700; letter-spacing: .5px; }
.topbar .brand small { font-weight: 400; opacity: .75; font-size: 12px; margin-left: 8px; }
.topbar .spacer { flex: 1; }
.topbar .nav-link {
  padding: 7px 16px; border-radius: 999px; font-size: 13.5px;
  background: rgba(255, 255, 255, .14); transition: background .2s;
}
.topbar .nav-link:hover { background: rgba(255, 255, 255, .28); }

/* ---------- 封面墙 ---------- */
.wall-hero {
  text-align: center; padding: 52px 20px 26px;
}
.wall-hero h1 { font-size: 30px; letter-spacing: 1px; }
.wall-hero p { color: var(--muted); margin-top: 10px; font-size: 15px; }
.wall-grid {
  display: grid; gap: 26px; padding: 20px 32px 60px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  max-width: 1280px; margin: 0 auto;
}
.book-card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: transform .22s, box-shadow .22s;
  cursor: pointer; display: flex; flex-direction: column;
}
.book-card:hover { transform: translateY(-6px); box-shadow: 0 14px 34px rgba(31, 51, 96, .18); }
.book-card .cover {
  aspect-ratio: 3 / 4; background: #dde3f0 center/cover no-repeat;
  position: relative;
}
.book-card .cover::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 55%, rgba(15,23,42,.55));
}
.book-card .pages-tag {
  position: absolute; right: 10px; top: 10px; z-index: 2;
  background: rgba(15, 23, 42, .62); color: #fff; font-size: 12px;
  padding: 3px 10px; border-radius: 999px;
}
.book-card .info { padding: 14px 16px 17px; }
.book-card .info h3 {
  font-size: 16px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.book-card .info p { margin-top: 6px; color: var(--muted); font-size: 12.5px; }
.empty-state {
  text-align: center; color: var(--muted); padding: 90px 20px;
}
.empty-state .big { font-size: 46px; margin-bottom: 14px; }

/* ---------- 阅读页（云展网式：顶栏 + 渐变舞台 + 底部工具条） ---------- */
.reader-wrap { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.reader-bar {
  display: flex; align-items: center; justify-content: center; gap: 10px; position: relative;
  padding: 10px 16px;
  background: linear-gradient(180deg, #1c2b50, #16233f); color: #fff;
  box-shadow: 0 2px 14px rgba(10, 18, 40, .35); z-index: 40;
}
.reader-bar .title-wrap { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 10px; }
.reader-bar .title { min-width: 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 阅读页顶栏品牌 Logo（可选，后台可配位置/高度）：居中=与书名并排；左/右=贴边绝对定位 */
.bar-logo { max-width: 40vw; object-fit: contain; }
.bar-logo.pos-left { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); }
.bar-logo.pos-right { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); }
.page-indicator {
  flex: none; padding: 4px 13px; border-radius: 999px; font-size: 12.5px; letter-spacing: 1px;
  background: rgba(255, 255, 255, .12); color: rgba(255, 255, 255, .85); white-space: nowrap;
}
.read-progress {
  position: absolute; left: 0; right: 0; top: 0; height: 3px; background: rgba(255, 255, 255, .10);
}
.read-progress i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent-2), #6ea8ff); transition: width .3s;
}
.side-backdrop { display: none; }
.reader-bar .btn,
.reader-tools .btn {
  padding: 6px 10px; border-radius: 9px; border: 1px solid rgba(255,255,255,.14); font-size: 12.5px;
  background: rgba(255,255,255,.10); color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
}
.reader-bar .btn:hover,
.reader-tools .btn:hover { background: rgba(255,255,255,.24); }
.reader-tools .btn.active { background: var(--accent-2); border-color: transparent; }
/* 桌面工具条图标化压成一行；按钮移入「更多」面板后自动恢复文字 */
.reader-tools .icon-only .btn-label { display: none; }
/* 底部工具条：桌面贴底单行横条（云展网 mainfoot），窄屏可横向滚动不换行；
   read-progress 阅读进度条贴其上沿（YouTube 式）；safe center 防溢出时左侧按钮被裁 */
.reader-tools {
  display: flex; align-items: center; justify-content: center; justify-content: safe center;
  flex-wrap: nowrap; overflow-x: auto; position: relative;
  gap: 5px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  background: #16233f; border-top: 1px solid rgba(255,255,255,.10); color: #fff; z-index: 45;
}
.reader-tools::-webkit-scrollbar { height: 0; }
/* 隐藏 DearFlip 自带工具条/缩放条/侧边箭头/侧边菜单——与本页工具栏、目录栏功能重复（底部两行、重复按钮）；
   仅 CSS 隐藏不删 DOM：setAutoPlay 依赖 ui.play 元素存在 */
#flipbook .df-ui-controls,
#flipbook .df-ui-zoom,
#flipbook .df-ui-prev:not(.df-ui-alt),
#flipbook .df-ui-next:not(.df-ui-alt),
#flipbook .df-outline-container { display: none !important; }
.reader-tools .more-btn { display: none; } /* 仅移动端显示「更多」 */
.tool-sep { width: 1px; height: 22px; background: rgba(255,255,255,.16); margin: 0 3px; flex: none; }
.fx-select {
  appearance: none; -webkit-appearance: none; flex: none;
  cursor: pointer; padding: 6px 22px 6px 8px; font-size: 12.5px; border-radius: 9px;
  border: 1px solid rgba(255,255,255,.14); background-color: rgba(255,255,255,.10); color: #fff;
  background-image: linear-gradient(45deg, transparent 50%, rgba(255,255,255,.75) 50%),
                    linear-gradient(135deg, rgba(255,255,255,.75) 50%, transparent 50%);
  background-position: calc(100% - 13px) 52%, calc(100% - 8px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.fx-select option { background: #16233f; color: #fff; }
.reader-main { flex: 1; display: flex; min-height: 0; position: relative; }
.reader-side {
  width: 264px; background: #fff; border-right: 1px solid #e5e9f2;
  display: flex; flex-direction: column; min-height: 0;
  overflow: hidden; transition: width .25s;
}
/* 桌面：目录栏可折叠（☰ 收起/展开） */
@media (min-width: 861px) {
  .reader-side:not(.open) { width: 0; border-right: 0; }
}
.side-head {
  padding: 13px 14px 9px; font-size: 13px; font-weight: 600;
  color: var(--muted); border-bottom: 1px solid #e8ecf5; letter-spacing: 2px;
}
.reader-side .tabs { display: flex; border-bottom: 1px solid #e8ecf5; }
.reader-side .tabs button {
  flex: 1; padding: 12px 0; border: 0; background: none; font-size: 13.5px; color: var(--muted);
  border-bottom: 2px solid transparent;
}
.reader-side .tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.reader-side .panel { flex: 1; overflow-y: auto; padding: 12px; }
.toc-item {
  padding: 9px 12px; border-radius: 8px; font-size: 13.5px; cursor: pointer;
  display: flex; justify-content: space-between; gap: 8px; position: relative;
}
.toc-item:hover { background: #eef2fb; }
.toc-item.active { background: #e3ebfb; color: var(--accent); font-weight: 600; }
.toc-item .pg { color: var(--muted); font-size: 12px; }
.toc-item.has-kids { padding-left: 32px; }
.toc-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toc-chev {
  position: absolute; left: 7px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; padding: 0; border: 0; border-radius: 5px;
  background: none; color: var(--muted); font-size: 11px; line-height: 18px;
  cursor: pointer; text-align: center;
}
.toc-chev:hover { background: #e6ecf9; color: var(--accent); }
.toc-children {
  margin-left: 16px; padding-left: 4px; border-left: 1px solid #e2e8f4;
}
.toc-children .toc-item.child { margin-left: 0; font-size: 12.5px; }
.thumb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.thumb {
  border: 2px solid transparent; border-radius: 8px; overflow: hidden; cursor: pointer;
  background: #eef1f8; position: relative;
}
.thumb img { width: 100%; display: block; aspect-ratio: 210/297; object-fit: cover; }
.thumb .no {
  position: absolute; left: 0; right: 0; bottom: 0; text-align: center;
  font-size: 11px; color: #fff; background: rgba(15,23,42,.55); padding: 2px 0;
}
.thumb.active { border-color: var(--accent-2); }
.reader-stage {
  flex: 1; min-width: 0; position: relative; overflow: hidden;
  background: radial-gradient(120% 100% at 50% 0%, #34426e 0%, #262f52 52%, #1b2340 100%);
}
#flipbook { width: 100%; height: 100%; }
.jump-box { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-top: 1px solid #e8ecf5; }
.jump-box input {
  width: 64px; padding: 6px 8px; border: 1px solid #d4dae8; border-radius: 8px; font-size: 13px; text-align: center;
}
.jump-box .total { color: var(--muted); font-size: 12px; }

/* ---------- 阅读页弹层（云展网 modern 面板式） ---------- */
.panel-mask {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, .5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.search-card, .help-card, .action-sheet {
  width: min(480px, calc(100vw - 32px)); max-height: 82vh; overflow-y: auto;
  background: #fff; border-radius: 18px; padding: 20px 22px;
  box-shadow: 0 24px 60px rgba(10, 20, 50, .35);
}
.search-card h3, .help-card h3, .action-sheet h3 { font-size: 16px; margin: 0 0 12px; }
.search-row { display: flex; gap: 8px; }
.search-row input {
  flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid #d4dae8; border-radius: 10px; font-size: 14px;
}
.search-row input:focus { outline: 2px solid var(--accent-2); border-color: transparent; }
.search-meta { margin: 10px 0 8px; font-size: 12.5px; color: var(--muted); min-height: 18px; }
.search-results { display: flex; flex-direction: column; gap: 8px; max-height: 44vh; overflow-y: auto; }
.search-item {
  text-align: left; border: 1px solid #e4e9f4; background: #f8fafd; border-radius: 10px;
  padding: 10px 12px; cursor: pointer; font-size: 13px; line-height: 1.65;
}
.search-item:hover { background: #eef3fd; border-color: var(--accent-2); }
.search-item b { color: var(--accent); margin-right: 8px; white-space: nowrap; }
.search-item mark { background: #ffe58f; border-radius: 3px; padding: 0 2px; }
.help-card ul { margin: 0 0 14px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 9px; font-size: 13.5px; color: var(--text); line-height: 1.7; }
.sheet-body { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 14px; }
.sheet-body .btn, .sheet-body .fx-select {
  width: 100%; justify-content: center; background: #f2f5fb; color: var(--text);
  border: 1px solid #e2e8f4;
}
.sheet-body .btn:hover, .sheet-body .fx-select:hover { background: #e8eefb; }
.sheet-body .fx-select { grid-column: 1 / -1; color: var(--text); background-color: #f2f5fb; }
.sheet-body .fx-select option { background: #fff; color: var(--text); }

/* ---------- 后台 ---------- */
.admin-wrap { max-width: 1180px; margin: 0 auto; padding: 26px 24px 70px; }
.panel-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 24px; margin-bottom: 22px;
}
.panel-card h2 { font-size: 17px; margin-bottom: 14px; }
.panel-card h2 small { color: var(--muted); font-weight: 400; font-size: 12.5px; margin-left: 10px; }

/* ---------- 后台多页面导航（页签 / 画册功能头） ---------- */
.view-tabs { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.view-tab {
  padding: 10px 22px; border-radius: 999px; font-size: 14px; font-weight: 600;
  background: var(--card); color: var(--muted); box-shadow: var(--shadow);
  border: 1.5px solid transparent; transition: all .18s;
}
.view-tab:hover { color: var(--accent); transform: translateY(-1px); }
.view-tab.active {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fff; box-shadow: 0 8px 20px rgba(46, 83, 149, .28);
}
.book-head {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 20px; margin-bottom: 18px;
}
.book-back {
  padding: 8px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  background: #e8edf8; color: var(--accent); transition: filter .15s;
}
.book-back:hover { filter: brightness(1.06); }
.book-title {
  font-size: 17px; font-weight: 700; letter-spacing: .5px;
  max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.feat-nav { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.feat-nav a {
  padding: 8px 18px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  background: #f2f5fc; color: var(--muted); border: 1.5px solid transparent; transition: all .18s;
}
.feat-nav a:hover { color: var(--accent); border-color: #c9d5ef; }
.feat-nav a.active {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fff; box-shadow: 0 6px 16px rgba(46, 83, 149, .25);
}
#bookTable td .btn.small { margin: 2px 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.form-item { display: flex; flex-direction: column; gap: 6px; }
.form-item label { font-size: 12.5px; color: var(--muted); }
.form-item input[type="text"], .form-item input[type="password"], .form-item textarea, .form-item select {
  padding: 9px 12px; border: 1px solid #d4dae8; border-radius: 9px; font-size: 14px; font-family: inherit;
}
.form-item textarea { resize: vertical; min-height: 66px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border-radius: 10px; border: 0; font-size: 14px; font-weight: 600;
  background: var(--accent); color: #fff; transition: filter .15s;
}
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: #e8edf8; color: var(--accent); }
.btn.danger { background: #d64545; }
.btn.small { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

.progress-wrap { margin-top: 16px; display: none; }
.progress-wrap.show { display: block; }
.progress-bar { height: 10px; background: #e8edf8; border-radius: 999px; overflow: hidden; }
.progress-bar i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .25s;
}
.progress-text { margin-top: 8px; font-size: 12.5px; color: var(--muted); }

table.list { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.list th, table.list td { padding: 11px 10px; text-align: left; border-bottom: 1px solid #edf0f7; vertical-align: middle; }
table.list th { color: var(--muted); font-weight: 600; font-size: 12px; }
table.list img.thumbimg { width: 44px; height: 60px; object-fit: cover; border-radius: 6px; background: #dde3f0; }
.badge {
  display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12px;
}
.badge.published { background: #e2f5e8; color: #1c7a3d; }
.badge.draft { background: #fdf1dc; color: #9a6b12; }
.badge.offline { background: #f3e4e4; color: #a33; }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin: 14px 0 20px; }
.stat-card {
  background: linear-gradient(135deg, #f6f8ff, #eef2fb);
  border-radius: 12px; padding: 16px 18px;
}
.stat-card .num { font-size: 26px; font-weight: 700; color: var(--accent); }
.stat-card .lbl { font-size: 12px; color: var(--muted); margin-top: 4px; }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 130px; padding: 10px 4px 0; }
.chart .bar {
  flex: 1; background: linear-gradient(180deg, var(--accent-2), var(--accent));
  border-radius: 6px 6px 0 0; min-height: 3px; position: relative;
}
.chart .bar span {
  position: absolute; bottom: -20px; left: 0; right: 0; text-align: center;
  font-size: 10px; color: var(--muted);
}
.chart-wrap { padding-bottom: 26px; }

.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(120deg, #1f3864, #3b5bfd);
}
.login-card {
  background: #fff; border-radius: 18px; padding: 38px 34px; width: 340px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
}
.login-card h1 { font-size: 20px; margin-bottom: 6px; }
.login-card p { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 14px; }
.login-err { color: #d64545; font-size: 12.5px; margin-top: 10px; min-height: 16px; }

.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%) translateY(20px);
  background: rgba(20, 28, 48, .92); color: #fff; padding: 11px 22px; border-radius: 10px;
  font-size: 13.5px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 860px) {
  /* 移动端阅读规划（参考云展网手机版）：图标顶栏 + 底部毛玻璃工具条 + 抽屉目录 + 更多面板 + 页面固定防滚动 */
  body.reader-body { position: fixed; inset: 0; overflow: hidden; overscroll-behavior: none; }
  .reader-bar { padding: 8px 12px; gap: 8px; }
  .reader-bar .title { font-size: 13px; }
  .page-indicator { font-size: 11.5px; padding: 3px 10px; letter-spacing: .5px; }
  .reader-tools {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    justify-content: space-between; flex-wrap: nowrap; gap: 6px;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
    background: rgba(22, 35, 63, .94);
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid rgba(255, 255, 255, .12);
  }
  .reader-tools .btn {
    flex: 1; justify-content: center; padding: 10px 4px; font-size: 12.5px; white-space: nowrap;
  }
  .reader-tools .tool-sep { display: none; }
  .reader-tools .more-btn { display: inline-flex; } /* 「更多」收纳低频功能 */
  .reader-main { padding-bottom: 62px; } /* 给底部工具条让位，书页不被遮挡 */
  .reader-side {
    position: absolute; left: 0; top: 0; bottom: 0; z-index: 30;
    transform: translateX(-100%); transition: transform .25s; box-shadow: 8px 0 24px rgba(0,0,0,.18);
  }
  .reader-side.open { transform: translateX(0); }
  .side-backdrop {
    display: block; position: absolute; inset: 0; z-index: 25;
    background: rgba(15, 23, 42, .45); opacity: 0; pointer-events: none; transition: opacity .25s;
  }
  .reader-side.open ~ .side-backdrop { opacity: 1; pointer-events: auto; }
  .toast { bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
  /* 「更多」贴底抽屉（云展网 sheet 式） */
  #moreMask { align-items: flex-end; }
  #moreMask .action-sheet {
    width: 100%; max-width: none; border-radius: 18px 18px 0 0;
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  }
  .search-card, .help-card { max-height: 86vh; }
  .wall-grid { padding: 16px; gap: 16px; }
  .admin-wrap { padding: 16px 12px 50px; }
}

/* ---- 分享弹层 ---- */
.share-mask {
  position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center;
  background: rgba(18, 26, 48, .55); backdrop-filter: blur(3px);
}
.share-card {
  background: #fff; border-radius: 18px; padding: 26px 28px 22px; width: 340px; max-width: calc(100vw - 32px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .28); text-align: center;
}
.share-card h3 { font-size: 17px; margin-bottom: 14px; }
.qr-box {
  width: 188px; height: 188px; margin: 0 auto; padding: 8px; border: 1px solid #e4e9f5;
  border-radius: 12px; background: #fff; display: flex; align-items: center; justify-content: center;
}
.qr-box svg { width: 100%; height: 100%; }
.qr-fallback { color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.share-hint { color: var(--muted); font-size: 12px; margin: 12px 0 14px; }
.share-link-row { display: flex; gap: 8px; }
.share-link-row input {
  flex: 1; padding: 9px 11px; border: 1px solid var(--border, #d7deee); border-radius: 9px;
  font-size: 12px; color: var(--muted); background: #f8faff;
}
.share-refs { margin-top: 12px; display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.share-ref-label { font-size: 12px; color: var(--muted); }
.share-ref.active { background: #e8eeff; border-color: #3b5bfd; color: #2b46c9; }

/* ---- 页眉页脚面板 ---- */
.var-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip {
  border: 1px solid #d7deee; background: #f4f7ff; color: #3a4b73; border-radius: 999px;
  padding: 4px 11px; font-size: 12px; cursor: pointer; transition: all .15s;
}
.chip:hover { background: #e8eeff; border-color: #3b5bfd; }
.hf-cols h3 { font-weight: 600; }

.hf-sub { font-size: 12.5px; color: var(--muted, #6b7280); margin: 4px 0 6px; font-weight: 600; }
.hf-page-rows { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 10px; }
.hf-page-row {
  display: grid; gap: 6px; align-items: center;
  grid-template-columns: 72px 84px repeat(6, minmax(64px, 1fr)) 48px 48px 58px;
  padding: 8px 10px; border: 1px solid #e2e8f4; border-radius: 10px; background: #f8faff;
}
.hf-page-row input[type="number"], .hf-page-row .hf-input {
  padding: 7px 9px; border: 1px solid #d7deee; border-radius: 8px; font-size: 12.5px;
  background: #fff; width: 100%; box-sizing: border-box;
}
.hf-page-row .hf-input:disabled { background: #eef1f8; color: #9aa3b5; }
.hf-page-row .hf-p-off-l { font-size: 12px; color: var(--muted, #6b7280); display: flex; align-items: center; gap: 4px; white-space: nowrap; }
@media (max-width: 1100px) {
  .hf-page-row { grid-template-columns: repeat(4, 1fr); }
}

/* ---- 多媒体热区：管理面板 ---- */
.hs-layout { display: grid; grid-template-columns: minmax(320px, 1.2fr) minmax(260px, 1fr); gap: 18px; margin-top: 12px; }
.hs-preview {
  position: relative; border: 1px solid #dfe5f2; border-radius: 12px; overflow: hidden;
  background: #f4f6fb; align-self: start;
}
.hs-preview img { width: 100%; display: block; }
.hs-layer { position: absolute; inset: 0; }
.hs-layer.drawing { cursor: crosshair; }
.hs-rect {
  position: absolute; border: 2px dashed #3b5bfd; background: rgba(59, 91, 253, .12);
  border-radius: 6px; cursor: pointer; box-sizing: border-box;
}
.hs-rect.video { border-color: #e8634b; background: rgba(232, 99, 75, .14); }
.hs-rect.audio { border-color: #17a673; background: rgba(23, 166, 115, .14); }
.hs-rect.active { border-style: solid; box-shadow: 0 0 0 3px rgba(59, 91, 253, .22); }
.hs-rect .hs-tag {
  position: absolute; top: -21px; left: -2px; font-size: 11px; padding: 1px 7px;
  background: #3b5bfd; color: #fff; border-radius: 6px 6px 0 0; white-space: nowrap;
}
.hs-rect.video .hs-tag { background: #e8634b; }
.hs-rect.audio .hs-tag { background: #17a673; }
.hs-side { display: flex; flex-direction: column; gap: 10px; }
.hs-list { display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow: auto; }
.hs-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid #e2e8f4;
  border-radius: 9px; font-size: 12.5px; cursor: pointer; background: #fff;
}
.hs-item:hover { border-color: #b9c6f2; }
.hs-item.active { border-color: #3b5bfd; background: #eef2ff; }
.hs-item .hs-ico { font-size: 15px; }
.hs-item .hs-empty { color: var(--muted, #6b7280); padding: 8px 2px; font-size: 12px; }
.hs-form { border: 1px solid #e2e8f4; border-radius: 10px; padding: 12px; background: #f8faff; }
.hs-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.hs-nums input { width: 100%; box-sizing: border-box; }

/* ---- 多媒体热区：阅读页 ---- */
.hs-hotspot {
  position: absolute; cursor: pointer; border-radius: 8px; box-sizing: border-box;
  display: flex; align-items: center; justify-content: center;
}
.hs-hotspot .hs-badge {
  width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: rgba(20, 28, 48, .62); color: #fff; font-size: 17px; line-height: 1;
  transition: transform .15s, background .15s;
}
.hs-hotspot:hover .hs-badge { transform: scale(1.12); background: rgba(59, 91, 253, .88); }
.hs-hotspot.video .hs-badge { background: rgba(232, 99, 75, .82); }
.hs-hotspot.audio .hs-badge { background: rgba(23, 166, 115, .82); }

/* ---- 媒体弹层（视频/音频） ---- */
.media-mask {
  position: fixed; inset: 0; background: rgba(12, 18, 34, .62); z-index: 200;
  display: flex; align-items: center; justify-content: center;
}
.media-card {
  background: #fff; border-radius: 16px; padding: 20px 22px; width: min(720px, calc(100vw - 32px));
  box-shadow: 0 24px 60px rgba(0, 0, 0, .3); text-align: center;
}
.media-card h3 { font-size: 16px; margin-bottom: 12px; }
.media-card video { width: 100%; max-height: 62vh; border-radius: 10px; background: #000; }
.media-card audio { width: 100%; margin: 18px 0; }

/* ---- 图片页眉页脚 ---- */
.hf-img-slot { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.hf-img-thumb {
  height: 34px; max-width: 150px; object-fit: contain; border: 1px solid #dfe5f2;
  border-radius: 8px; background: #fff; padding: 2px; cursor: pointer;
}
.hf-img-mask {
  position: fixed; inset: 0; z-index: 150; display: flex; align-items: center; justify-content: center;
  background: rgba(18, 26, 48, .55); backdrop-filter: blur(3px);
}
.hf-img-card {
  background: #fff; border-radius: 18px; padding: 24px 26px 20px; width: 420px; max-width: calc(100vw - 32px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .28);
}
.hf-img-card h3 { font-size: 16px; margin-bottom: 12px; }
.hf-img-preview {
  height: 92px; border: 1px dashed #d4dae8; border-radius: 10px; background: #f8faff;
  display: flex; align-items: center; justify-content: center; overflow: hidden; margin-bottom: 12px;
}
.hf-img-preview img { max-height: 84px; max-width: 100%; object-fit: contain; }
.hf-img-preview img:not([src]), .hf-img-preview img[src=""] { display: none; }

/* ---- 热区媒体上传 ---- */
.hs-up-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hs-up-name { font-size: 12px; color: var(--muted, #6b7280); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- 画布编辑器 ---- */
.ed-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; margin: 12px 0; border: 1px solid #e2e8f4; border-radius: 12px; background: #f8faff;
}
.ed-sep { width: 1px; height: 24px; background: #dfe5f2; margin: 0 4px; }
.ed-lbl { font-size: 12px; color: var(--muted, #6b7280); }
.ed-num { width: 62px; padding: 6px 8px; border: 1px solid #d7deee; border-radius: 8px; font-size: 12.5px; }
.ed-color { width: 42px; height: 32px; padding: 2px; border: 1px solid #d7deee; border-radius: 8px; background: #fff; }
.ed-toolbar select { padding: 7px 9px; border: 1px solid #d7deee; border-radius: 8px; font-size: 12.5px; }
.ed-text-input {
  flex: 1; min-width: 180px; padding: 7px 10px; border: 1px solid #d7deee; border-radius: 8px; font-size: 12.5px;
}
.ed-toolbar .btn.active { background: var(--accent); color: #fff; }
.ed-wrap {
  border: 1px solid #dfe5f2; border-radius: 12px; background: #e9edf6;
  overflow: auto; padding: 14px; display: flex; justify-content: center;
}
.ed-stage {
  position: relative; flex: none; /* 视觉尺寸盒子：缩放后的画布居中放置，横竖版都居中 */
}
.ed-canvas {
  position: absolute; top: 0; left: 0; width: 1240px; height: 1754px;
  background: #fff center/100% 100% no-repeat; transform-origin: top left;
  box-shadow: 0 10px 30px rgba(31, 51, 96, .18);
}
.ed-block {
  position: absolute; box-sizing: border-box; cursor: move; overflow: hidden;
  border: 1.5px solid transparent;
}
.ed-block:hover { border-color: rgba(59, 91, 253, .45); }
.ed-block.selected { border-color: #3b5bfd; box-shadow: 0 0 0 3px rgba(59, 91, 253, .18); }
.ed-block img { width: 100%; height: 100%; object-fit: fill; display: block; pointer-events: none; }
.ed-bcanvas { display: block; width: 100%; height: 100%; pointer-events: none; }
.ed-btext {
  width: 100%; height: 100%; white-space: pre-wrap; word-break: break-word; outline: none;
  line-height: 1.5; position: relative; overflow: hidden;
}
/* Word 原文块（富文本）预览样式 */
.ed-btext.rich { text-align: left; }
.ed-btext.quote { border-left: 5px solid #e8eeff; padding-left: 39px; box-sizing: border-box; }
.ed-btext.h1bar::after {
  content: ""; display: block; width: 96px; height: 6px; background: #2e5395; margin-top: 8px;
}
.ed-marker { position: absolute; top: 0; color: #4a5568; pointer-events: none; }
.ed-btext table { border-collapse: collapse; width: 100%; }
.ed-btext td, .ed-btext th {
  border: 1px solid #c9d2e4; padding: 4px 10px; font-size: 20px; color: #3a4358; vertical-align: top;
}
.ed-btext td.head { background: #eef2fb; color: #22304f; }
.ed-btext.hrline::after { content: ""; display: block; height: 2px; background: #d7deee; margin-top: 12px; }
.ed-resize {
  position: absolute; right: -6px; bottom: -6px; width: 14px; height: 14px;
  background: #3b5bfd; border: 2px solid #fff; border-radius: 4px; cursor: nwse-resize; z-index: 3;
}
.ed-block.dragging { opacity: .82; }
