/* ==========================================================================
   拾光影集 · 移动端样式表
   ==========================================================================
   所有规则都用 @media (max-width: 768px) 包住，不影响桌面端。
   结构：
     1. 全局基础（body / 输入 / 按钮触控目标）
     2. 编辑器主视图（预览 + 缩略图 + 动作 + 底部 nav）
     3. 其它页面占位（Phase 3 会补）
   ========================================================================== */

@media screen and (max-width: 768px) {

  /* ============ 0. 全局基础 ============ */
  html, body {
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: contain;
  }
  body {
    font-size: 14px;
  }
  /* 所有可点击目标至少 40px 触控高度 */
  input, textarea, select, button {
    font-size: 14px;
  }
  /* iOS 自动缩放输入框时会放大整页：输入框至少 16px 可避免 */
  input[type="text"], input[type="number"], input[type="email"],
  input[type="password"], input[type="search"], textarea {
    font-size: 16px;
  }

  /* ============ 1. 编辑器 — 整体容器 ============ */
  .editor-wrap {
    background: #f5f5f5;
  }

  /* 桌面头/脚/侧栏/右栏全部隐藏（抽屉保留，见第 10 节） */
  .editor-wrap .ed-header,
  .editor-wrap .ed-sidebar,
  .editor-wrap .ed-actions,
  .editor-wrap .ed-canvas-top {
    display: none !important;
  }
  /* 手机端浮动缩放控件 */
  .mob-zoom-float {
    position: absolute;
    top: 50px;
    right: 8px;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(255,255,255,.92);
    border-radius: 16px;
    box-shadow: 0 1px 6px rgba(0,0,0,.12);
    padding: 2px 4px;
  }
  .mz-btn {
    width: 28px;
    height: 28px;
    border: 0;
    background: transparent;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
  }
  .mz-btn:active { background: rgba(0,0,0,.08); }
  .mz-val {
    font-size: 11px;
    color: #666;
    min-width: 32px;
    text-align: center;
  }
  .editor-wrap .ed-body {
    display: block;
    grid-template-columns: none;
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }
  /* 画布区占满、自适应 */
  .editor-wrap .ed-canvas-area {
    height: 100%;
    padding: 0;
    overflow: hidden;
  }
  .editor-wrap .ed-canvas-scroll {
    width: 100%;
    height: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding: 6px 12px;
  }

  /* ============ 2. 移动端专用：顶栏（书名 + 页码） ============ */
  .mob-ed-top {
    flex: 0 0 auto;
    padding: 10px 14px 6px;
    text-align: center;
    background: transparent;
    position: relative;
  }
  .mob-ed-top .mob-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--ink);
    line-height: 1.2;
    max-width: 70%;
    margin: 0 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mob-ed-top .mob-subtitle {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
    letter-spacing: 1px;
  }
  .mob-ed-top .mob-back {
    position: absolute;
    left: 8px;
    top: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--ink-2);
  }
  .mob-ed-top .mob-save-status {
    position: absolute;
    right: 10px;
    top: 12px;
    font-size: 11px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 4px;
  }

  /* ============ 3. 预览区样式：让画布有卡片感 ============ */
  .editor-wrap .ed-page-wrap {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,.08);
    border-radius: 2px;
    margin: auto;
  }

  /* ============ 4. 缩略图横滑区 ============ */
  .mob-ed-thumbs-wrap {
    flex: 0 0 auto;
    background: #fff;
    border-top: 1px solid var(--line);
  }
  .mob-ed-thumbs {
    display: flex;
    gap: 10px;
    padding: 10px 14px 6px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }
  .mob-ed-thumbs::-webkit-scrollbar { display: none; }
  .mob-ed-thumb {
    flex: 0 0 auto;
    width: 46px;
    text-align: center;
    scroll-snap-align: center;
    cursor: pointer;
  }
  .mob-ed-thumb .m-thumb-frame {
    width: 46px;
    height: 64px;
    background: #fff;            /* T01：空页也用白底+边框看起来像一张"纸"缩略图 */
    border: 1.5px solid #ddd;
    border-radius: 3px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
  }
  .mob-ed-thumb.active .m-thumb-frame {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px rgba(245,99,104,.15);
  }
  .mob-ed-thumb .m-thumb-frame > img,
  .mob-ed-thumb .m-thumb-frame .cc-fullbg,
  .mob-ed-thumb .m-thumb-frame .lc-user-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .mob-ed-thumb .m-thumb-frame .ovl-sticker-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
  .mob-ed-thumb .m-thumb-frame .cover-canvas,
  .mob-ed-thumb .m-thumb-frame .decor-canvas,
  .mob-ed-thumb .m-thumb-frame .layout-canvas,
  .mob-ed-thumb .m-thumb-canvas-scaled,
  .mob-ed-thumb .m-thumb-page {
    width: 100% !important;
    height: 100% !important;
    box-shadow: none !important;
  }
  .mob-ed-thumb .m-thumb-canvas-scaled,
  .mob-ed-thumb .m-thumb-page {
    position: relative;
    overflow: hidden;
    background: #fff;
    pointer-events: none;
  }
  .mob-ed-thumb .m-thumb-scale-inner {
    width: 640px;
    height: 906px;
    position: relative;
    transform: translateX(.4px) scale(0.07064);
    transform-origin: top left;
  }
  .mob-ed-thumb .m-thumb-scale-inner .ed-page-footer > * {
    visibility: hidden !important;
  }
  .mob-ed-thumb .m-thumb-text-title {
    background: transparent;
    border: 0;
    font: inherit;
    font-family: var(--s-heading-font);
    font-size: 24px;
    color: var(--s-accent);
    text-align: center;
    letter-spacing: var(--s-h2-letter);
  }
  .mob-ed-thumb .m-thumb-text-body {
    flex: 1;
    font-size: 16px;
    line-height: 2;
    color: var(--s-text);
    font-family: inherit;
    white-space: pre-wrap;
    overflow: hidden;
  }
  .mob-ed-thumb .m-thumb-frame .overlay-layer {
    pointer-events: none !important;
  }
  .mob-ed-thumb .m-thumb-frame .ovl-item {
    cursor: default;
  }
  .mob-ed-thumb .m-thumb-frame .lc-pic-caption {
    display: none !important;
  }
  .mob-ed-thumb .m-thumb-copyright {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    color: #999;
  }
  .mob-ed-thumb .m-thumb-copy-title {
    font-size: 6px;
    color: #777;
  }
  .mob-ed-thumb .m-thumb-copy-line {
    width: 28px;
    height: 1px;
    background: #ddd;
  }
  .mob-ed-thumb .m-thumb-copy-line.short {
    width: 20px;
  }
  .mob-ed-thumb .m-thumb-frame .m-thumb-fallback {
    font-size: 13px;
    font-weight: 600;
    color: #b6b3ad;
    line-height: 1.2;
    text-align: center;
    padding: 2px;
    /* T01：空页 fallback 改成像页脚页码的样式 */
    width: 100%;height: 100%;display: flex;align-items: flex-end;justify-content: center;
    padding-bottom: 8px;
    background: linear-gradient(180deg, #fff 0%, #fafafa 80%, #f0f0f0 100%);
    border: 1px dashed #e5e3de;
    box-sizing: border-box;
  }
  .mob-ed-thumb .m-thumb-label {
    font-size: 10px;
    color: var(--ink-2);
    margin-top: 3px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mob-ed-thumb.active .m-thumb-label {
    color: var(--primary);
  }

  /* ============ 5. 上下文动作按钮条 ============ */
  .mob-ed-actions {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
    padding: 8px 14px 10px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    align-items: center;
  }
  .mob-ed-actions .mob-act-btn {
    flex: 1 1 0;
    padding: 10px 6px;
    border-radius: 4px;
    font-size: 13px;
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line-2);
    text-align: center;
    white-space: nowrap;
    transition: all .12s;
  }
  .mob-ed-actions .mob-act-btn:active {
    background: var(--bg-2);
  }
  .mob-ed-actions .mob-act-btn.primary {
    background: #9ed2c0;
    color: #fff;
    border-color: #9ed2c0;
  }
  .mob-ed-actions .mob-act-btn.primary:active {
    background: #8ec0ae;
  }
  .mob-ed-actions .mob-act-btn.danger {
    color: #c0392b;
    border-color: #f0d0cc;
  }
  /* 操作下拉按钮（带三角） */
  .mob-ed-actions .mob-act-btn.has-menu::after {
    content: ' ▴';
    font-size: 10px;
    color: var(--muted);
    margin-left: 2px;
  }

  /* ============ 6. 底部 5-tab nav ============ */
  .mob-ed-bottom-nav {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-top: 1px solid var(--line);
  }
  .mob-ed-bottom-nav .mnb-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 2px;
    border-radius: 6px;
    font-size: 11px;
    color: var(--ink-2);
    background: transparent;
    position: relative;
  }
  .mob-ed-bottom-nav .mnb-item .mnb-icon {
    font-size: 20px;
    line-height: 1;
    color: var(--muted);
  }
  .mob-ed-bottom-nav .mnb-item.primary {
    background: var(--primary);
    color: #fff;
  }
  .mob-ed-bottom-nav .mnb-item.primary .mnb-icon {
    color: #fff;
  }
  .mob-ed-bottom-nav .mnb-item:active {
    background: var(--bg-2);
  }
  .mob-ed-bottom-nav .mnb-item.primary:active {
    background: var(--primary-dark);
  }

  /* ============ 7. "操作" 下拉菜单 ============ */
  .mob-op-menu-mask {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: transparent;
  }
  .mob-op-menu {
    position: fixed;
    z-index: 91;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 6px 24px rgba(0,0,0,.16);
    min-width: 130px;
    padding: 4px 0;
    overflow: hidden;
  }
  .mob-op-menu .mop-item {
    display: block;
    width: 100%;
    padding: 12px 18px;
    text-align: left;
    background: transparent;
    font-size: 14px;
    color: var(--ink);
    border: 0;
  }
  .mob-op-menu .mop-item:active {
    background: var(--bg-2);
  }
  .mob-op-menu .mop-item.danger {
    color: #c0392b;
  }
  .mob-op-menu .mop-sep {
    height: 1px;
    background: var(--line);
    margin: 3px 0;
  }

  /* ============ 8. 溢出工具栏隐藏（overlay 文本编辑工具条） ============ */
  .editor-wrap .ovl-text-toolbar {
    display: none !important;
  }

  /* ============ 9. Toast 位置上移（避开底栏） ============ */
  /* 必须同时 reset top，否则 top+bottom 都有值会让元素被撑到满屏高 */
  .toast {
    top: auto !important;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
    max-width: calc(100vw - 32px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ============ 10. 通用 modal · 统一为底部抽屉 ============ */
  /* 所有 .modal-mask 在手机端改为底部对齐；.modal / .modal-card 全宽贴底 */
  .modal-mask {
    padding: 0 !important;
    align-items: flex-end !important;
    background: rgba(0,0,0,.35) !important;
  }
  .modal-mask > .modal,
  .modal-mask > .modal-card {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 88vh !important;
    border-radius: 14px 14px 0 0 !important;
    margin: 0 !important;
  }
  /* modal head 紧凑 */
  .modal-mask > .modal-card .modal-head {
    padding: 10px 14px !important;
  }
  .modal-mask > .modal-card .modal-title {
    font-size: 14px !important;
  }
  .modal-mask > .modal-card .modal-body {
    padding: 12px 14px !important;
  }
  .modal-mask > .modal-card .modal-foot {
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .photo-edit-mask {
    padding: 0 !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
  }
  .photo-edit-modal {
    flex: 1 !important;
    width: 100% !important;
    height: auto !important;
    max-width: 560px !important;
    margin: 0 auto !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
  .pe-head {
    padding: 12px 16px !important;
    background: transparent !important;
    border-bottom: 0 !important;
  }
  .pe-stage {
    padding: 0 !important;
    min-height: 0 !important;
  }
  .pe-rotate-row {
    padding: 14px 22px 8px !important;
    background: transparent !important;
  }
  .pe-scale-row {
    padding: 6px 18px 14px !important;
    background: transparent !important;
  }
  .pe-foot {
    padding: 10px 12px calc(28px + env(safe-area-inset-bottom, 0px)) !important;
    background: transparent !important;
  }

  /* ============ 10a. 版式选择弹窗 · 小卡片横滑 ============ */
  .modal-layout-v2 {
    max-height: 60vh !important;
  }
  .modal-layout-v2 .modal-head {
    padding: 10px 14px !important;
  }
  .modal-layout-v2 .modal-title {
    font-size: 14px !important;
  }
  /* 隐藏多余的分类行，只保留风格 pill + 图数筛选 */
  .modal-layout-v2 .lp-mode-tabs,
  .modal-layout-v2 .lp-group-tabs {
    display: none !important;
  }
  .modal-layout-v2 .lp-slot-filter {
    display: flex !important;
    padding: 6px 10px !important;
    gap: 4px !important;
    border-bottom: 1px solid var(--line) !important;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .modal-layout-v2 .lp-slot-filter button {
    padding: 6px 12px !important;
    font-size: 12px !important;
    border-radius: 14px !important;
    flex-shrink: 0;
  }
  .modal-layout-v2 .lp-style-tabs {
    padding: 6px 10px !important;
    gap: 4px !important;
    border-bottom: 1px solid var(--line) !important;
  }
  .modal-layout-v2 .lp-style-tabs button {
    padding: 6px 12px !important;
    font-size: 12px !important;
    border-radius: 14px !important;
    flex-shrink: 0;
  }
  .modal-layout-v2 .lp-style-tabs .cnt {
    display: none;  /* 省空间，去掉数量 */
  }
  /* 卡片区：横向滚动，小卡片 */
  .modal-layout-v2 .modal-body {
    padding: 0 !important;
  }
  .modal-layout-v2 .layout-pick-grid-v2 {
    display: flex !important;
    grid-template-columns: none !important;
    gap: 8px !important;
    padding: 10px !important;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .modal-layout-v2 .layout-pick-grid-v2::-webkit-scrollbar { display: none; }
  .modal-layout-v2 .lp-card-v2 {
    flex: 0 0 auto !important;
    width: 82px !important;
    border-width: 1.5px !important;
  }
  .modal-layout-v2 .lp-card-v2:hover {
    transform: none !important;
  }
  .modal-layout-v2 .lp-card-v2 .lp-preview-wrap {
    height: 116px;
  }
  .modal-layout-v2 .lp-meta {
    padding: 3px 6px !important;
    font-size: 10px !important;
  }
  .modal-layout-v2 .lp-slot-badge {
    padding: 1px 4px !important;
    font-size: 9px !important;
  }
  .modal-layout-v2 .lp-page-name {
    display: none;  /* 小卡片下只显示图数徽章 */
  }
  .modal-layout-v2 .lp-card-v2 .lp-check {
    width: 18px !important;
    height: 18px !important;
    font-size: 11px !important;
    top: 4px !important;
    right: 4px !important;
  }
  .modal-layout-v2 .lp-empty {
    padding: 20px !important;
    font-size: 12px !important;
    width: 100%;
  }

  /* ============ 10b. 快捷内置版式（相同 picker 的另一 tab） ============ */
  .modal-layout-v2 .layout-pick-grid {
    display: flex !important;
    grid-template-columns: none !important;
    gap: 8px !important;
    padding: 10px !important;
    overflow-x: auto;
  }
  .modal-layout-v2 .layout-pick-grid .lp-card {
    flex: 0 0 auto;
    width: 82px;
  }

  /* ============ 10d. 图库弹窗（GalleryModal modal variant） ============ */
  .gallery-modal {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92vh !important;
  }
  .gallery-modal .gallery-head {
    flex-wrap: wrap;
    padding: 10px 12px !important;
    gap: 6px !important;
  }
  .gallery-modal .gallery-title {
    width: 100%;
    font-size: 13px;
    color: var(--muted);
  }
  .gallery-modal .gallery-actions {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
  }
  .gallery-modal .gallery-actions .btn-link {
    padding: 4px 8px !important;
    font-size: 12px !important;
  }
  .gallery-modal .gallery-body {
    padding: 10px 12px !important;
    min-height: 0 !important;
  }
  /* 3 列替代 4 列，卡片更大更易点 */
  .gallery-modal .cp-grid.cp-grid-4 {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
  }
  .gallery-modal .gallery-footer {
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)) !important;
  }
  /* cp-upload-card 内字号 */
  .cp-upload-card {
    font-size: 12px !important;
  }

  /* ============ 10e. 风格弹窗（StyleModal） ============ */
  .style-modal {
    max-height: 82vh !important;
  }
  .style-modal .style-head {
    padding: 12px 14px !important;
  }
  .style-modal .style-head h3 {
    font-size: 15px !important;
    margin: 0 0 4px !important;
  }
  .style-modal .style-body {
    padding: 10px 12px !important;
  }
  .style-modal .style-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
  }
  .style-modal .style-sample {
    padding: 5px !important;
  }
  .style-modal .ss-title {
    font-size: 10px !important;
  }
  .style-modal .ss-copy {
    font-size: 6px !important;
  }
  .style-modal .style-info {
    padding: 6px 4px !important;
  }
  .style-modal .style-name {
    font-size: 13px !important;
    text-align: center;
    letter-spacing: 0 !important;
  }

  /* ============ 10f. 分享弹窗（ShareModal） ============ */
  .share-modal {
    max-height: calc(100vh - 8px) !important;
    max-height: calc(100dvh - 8px) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .share-modal .share-head {
    padding: 12px 18px !important;
    position: sticky;
    top: 0;
    z-index: 3;
    background: #fff;
  }
  .share-modal .share-head h3 {
    font-size: 15px !important;
    margin: 0 !important;
  }
  .share-modal .share-card-inner {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 14px !important;
    padding: 16px 18px 10px !important;
  }
  .share-modal .sc-preview .cover-canvas,
  .share-modal .sc-preview .sc-cover,
  .share-modal .sc-cover-empty {
    width: min(38vw, 142px) !important;
  }
  .share-modal .sc-info {
    width: 100%;
  }
  .share-modal .sc-info h2 {
    font-size: 20px !important;
    margin-bottom: 6px !important;
  }
  .share-modal .sc-stats {
    gap: 8px !important;
    padding-top: 10px !important;
  }
  .share-modal .share-link-row {
    padding: 8px 18px 12px !important;
  }
  .share-modal .share-link-box {
    min-height: 44px;
  }
  .share-modal .share-link-box input {
    font-size: 15px !important;
  }
  .share-modal .share-hint {
    line-height: 1.6;
  }
  .share-modal .share-actions {
    position: sticky;
    bottom: 0;
    z-index: 3;
    background: #fff;
    box-shadow: 0 -8px 18px rgba(0,0,0,.06);
    padding: 10px 18px calc(10px + env(safe-area-inset-bottom, 0px)) !important;
    gap: 10px !important;
  }
  .share-modal .share-actions .btn {
    flex: 1 1 0;
    min-height: 42px;
    justify-content: center;
    padding: 9px 10px !important;
    white-space: nowrap;
  }

  /* ============ 10g. 贴图选择（StickerPickModal 使用 .modal-wide 类） ============ */
  .modal-wide {
    max-height: 82vh !important;
  }
  .modal-wide .sticker-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 6px !important;
    max-height: none !important;
  }
  .modal-wide .sticker-card {
    font-size: 11px;
  }
  .modal-wide .remote-cat-pills {
    padding: 6px 10px !important;
    gap: 4px !important;
    overflow-x: auto;
    flex-wrap: nowrap;
    display: flex;
  }
  .modal-wide .remote-cat-pills .cat-pill {
    flex-shrink: 0;
    padding: 4px 10px !important;
    font-size: 11px !important;
  }
  .modal-wide .modal-tabs {
    padding: 0 10px !important;
    gap: 14px !important;
    overflow-x: auto;
    flex-wrap: nowrap;
  }
  .modal-wide .modal-tabs button {
    flex-shrink: 0;
    padding: 10px 0 !important;
    font-size: 13px !important;
  }

  /* ============ 10h. 添加页（AddPageModal） ============ */
  .modal-addpage {
    max-height: 85vh !important;
  }
  .modal-addpage .modal-tabs {
    padding: 0 10px !important;
    gap: 12px !important;
    overflow-x: auto;
    flex-wrap: nowrap;
  }
  .modal-addpage .modal-tabs button {
    flex-shrink: 0;
    padding: 10px 0 !important;
    font-size: 13px !important;
  }
  .modal-addpage .addpage-layout-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
  }
  .modal-addpage .ap-layout-btn {
    padding: 6px !important;
  }
  .modal-addpage .ap-layout-btn svg {
    width: 46px !important;
  }
  .modal-addpage .decor-template-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }

  /* ============ 10i. 文本库（TextLibraryModal） ============ */
  /* 强制全弹层 flex 列布局 + 固定高度，子区块才能正确分配空间 */
  .modal-text-library {
    width: 100% !important;
    max-width: 100% !important;
    height: 88vh !important;
    max-height: 88vh !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }
  /* 重置通用 modal-body 内边距：list 自管 padding；让滚动区真正占满 */
  .modal-text-library .modal-body.tl-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;        /* 关键：让 flex:1 子项能在 column 容器里收缩 */
    padding: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    /* T09：强制块级布局，避免 flex 子项 overflow 被父级裁切导致滑不动 */
    display: block !important;
    overscroll-behavior: contain;
    touch-action: pan-y !important;
  }
  /* T09：保险——里面的 ul 也撑开，不要被 flex 收缩 */
  .modal-text-library .tl-body .tl-list {
    height: auto !important;
    overflow: visible !important;
  }
  .modal-text-library .modal-head,
  .modal-text-library .tl-cats,
  .modal-text-library .tl-search,
  .modal-text-library .modal-foot {
    flex: 0 0 auto !important;
  }
  /* 类别 tabs：单行横滑，不换行不挤压 */
  .modal-text-library .tl-cats {
    padding: 8px 12px !important;
    gap: 6px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    flex-wrap: nowrap !important;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .modal-text-library .tl-cats::-webkit-scrollbar { display: none; }
  .modal-text-library .tl-cats > * {
    flex-shrink: 0 !important;
  }
  .modal-text-library .tl-list { padding: 10px 12px 14px !important; }

  /* ============ 10j. 装饰页编辑（DecorEditModal） ============ */
  .modal-decor {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 90vh !important;
  }

  /* ============ 10k. 封面选择（CoverPickerModal） ============ */
  .cover-picker {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92vh !important;
  }
  .cover-picker .cover-tabs {
    padding: 6px 10px !important;
    gap: 4px !important;
    overflow-x: auto;
    flex-wrap: nowrap;
  }
  .cover-picker .cover-tab {
    padding: 6px 12px !important;
    font-size: 12px !important;
    flex-shrink: 0;
  }
  .cover-picker .cp-body {
    padding: 10px 12px !important;
  }
  /* 本地模板行：横滑 */
  .cover-picker .cp-local-row {
    display: flex !important;
    gap: 8px !important;
    overflow-x: auto;
    padding-bottom: 4px;
    flex-wrap: nowrap;
  }
  .cover-picker .cp-local-row .cp-cover-card-local {
    flex: 0 0 110px !important;
    width: 110px !important;
  }
  .cover-picker .cp-group-tabs {
    padding: 4px 0 !important;
    gap: 4px !important;
    overflow-x: auto;
    flex-wrap: nowrap;
    display: flex;
  }
  .cover-picker .cp-group-tabs button {
    flex-shrink: 0;
    padding: 4px 10px !important;
    font-size: 12px !important;
  }
  /* 封面模板网格改成 3 列 */
  .cover-picker .cp-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
  }
  .cover-picker .cp-footer {
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* ============ 10z. 移动端底部文本编辑面板 mob-text-panel（不遮画布） ============ */
  .mob-text-panel {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: #fff;
    z-index: 70;
    box-shadow: 0 -8px 24px rgba(0,0,0,.10);
    border-top: 1px solid var(--line);
    border-radius: 14px 14px 0 0;
    display: flex;
    flex-direction: column;
    max-height: 68vh;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .mob-text-panel .mtp-tabs {
    display: flex;
    gap: 18px;
    padding: 10px 16px 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    flex: 0 0 auto;
  }
  .mob-text-panel .mtp-tabs::-webkit-scrollbar { display: none; }
  .mob-text-panel .mtp-tabs button {
    flex: 0 0 auto;
    padding: 8px 2px 10px;
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    color: var(--ink-2);
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
  }
  .mob-text-panel .mtp-tabs button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 500;
  }
  .mob-text-panel .mtp-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 6px;
    flex: 0 0 auto;
  }
  .mob-text-panel .mtp-meta-info {
    color: var(--muted);
    font-size: 12px;
  }
  .mob-text-panel .mtp-lib-link {
    color: var(--primary);
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
  }
  .mob-text-panel .mtp-textarea,
  .mob-text-panel .mtp-input {
    flex: 1 1 auto;
    margin: 0 14px 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 15px;
    line-height: 1.7;
    color: var(--ink);
    background: #fff;
    font-family: inherit;
    resize: none;
    -webkit-appearance: none;
    appearance: none;
    min-height: 90px;
    max-height: 26vh;
  }
  .mob-text-panel .mtp-input { flex: 0 0 auto; }
  .mob-text-panel .mtp-textarea:focus,
  .mob-text-panel .mtp-input:focus {
    outline: none;
    border-color: var(--primary);
  }
  /* 字体调整按钮条（textarea 与 foot 之间） */
  .mob-text-panel .mtp-styles {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 4px 14px 10px;
    position: relative;
  }
  .mob-text-panel .mtp-style-cell {
    position: relative;
    min-width: 0;
  }
  /* 行 2：颜色 + 对齐，两个各跨 2 列变成全宽，标签完整显示 */
  .mob-text-panel .mtp-style-cell:nth-child(5),
  .mob-text-panel .mtp-style-cell:nth-child(6) {
    grid-column: span 2;
  }
  .mob-text-panel .mtp-style-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    padding: 8px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    overflow: hidden;
    white-space: nowrap;
  }
  .mob-text-panel .mtp-style-btn.open {
    border-color: var(--primary);
    color: var(--primary);
  }
  .mob-text-panel .mtp-sb-icon {
    flex: 0 0 auto;
    font-weight: 600;
    color: var(--ink-2);
    width: 14px;
    text-align: center;
  }
  .mob-text-panel .mtp-style-btn.open .mtp-sb-icon { color: var(--primary); }
  .mob-text-panel .mtp-sb-tr { font-style: italic; font-family: Georgia, serif; }
  .mob-text-panel .mtp-sb-aa { font-size: 16px; font-weight: 700; line-height: 1; }
  .mob-text-panel .mtp-sb-val {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
  }
  .mob-text-panel .mtp-sb-caret {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 10px;
  }
  .mob-text-panel .mtp-sb-dot {
    flex: 0 0 auto;
    width: 12px; height: 12px; border-radius: 50%;
    border: 1px solid rgba(0,0,0,.12);
  }
  .mob-text-panel .mtp-box-size {
    grid-column: 1 / -1;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 9px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .mob-text-panel .mtp-box-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    color: var(--ink);
    font-weight: 500;
  }
  .mob-text-panel .mtp-box-head button {
    border: 0;
    background: transparent;
    color: var(--primary);
    font-size: 12px;
    cursor: pointer;
    padding: 0;
  }
  .mob-text-panel .mtp-box-size label {
    display: grid;
    grid-template-columns: 74px 1fr;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--ink-2);
  }
  .mob-text-panel .mtp-box-size input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
  }
  /* 弹出层 */
  .mob-text-panel .mtp-pop {
    position: absolute;
    left: 0;
    bottom: calc(100% + 6px);
    min-width: 100%;
    max-width: 70vw;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0,0,0,.14);
    padding: 4px 0;
    z-index: 5;
    -webkit-overflow-scrolling: touch;
  }
  .mob-text-panel .mtp-pop-item {
    padding: 9px 14px;
    font-size: 14px;
    color: var(--ink);
    white-space: nowrap;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .mob-text-panel .mtp-pop-item:active { background: var(--bg-2); }
  .mob-text-panel .mtp-pop-item.active {
    color: var(--primary);
    font-weight: 500;
    background: rgba(245, 99, 104, .08);
  }
  .mob-text-panel .mtp-pop-dot {
    display: inline-block;
    width: 12px; height: 12px; border-radius: 50%;
    background: linear-gradient(135deg, #ddd 50%, #fff 50%);
    border: 1px solid rgba(0,0,0,.15);
  }
  .mob-text-panel .mtp-pop-colors { padding: 8px; }
  .mob-text-panel .mtp-color-grid {
    display: grid;
    grid-template-columns: repeat(4, 28px);
    gap: 8px;
    padding: 4px 6px 2px;
  }
  .mob-text-panel .mtp-color-swatch {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,.12);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    padding: 0;
  }
  .mob-text-panel .mtp-color-swatch.active {
    box-shadow: 0 0 0 2px var(--primary);
  }

  .mob-text-panel .mtp-foot {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 8px 14px 14px;
    border-top: 1px solid var(--line);
    flex: 0 0 auto;
    background: #fff;
  }
  .mob-text-panel .mtp-btn {
    padding: 13px 0;
    font-size: 15px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    font-weight: 500;
  }
  .mob-text-panel .mtp-btn.mtp-save {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
  }
  .mob-text-panel .mtp-btn.mtp-cancel:active { background: var(--bg-2); }
  .mob-text-panel .mtp-btn.mtp-save:active { background: var(--primary-dark, #d94a4a); }

  /* ============ 11. 抽屉（撰写文本/移动页面）手机端变全屏层 ============ */
  .editor-wrap .ed-drawer {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    z-index: 80;
    background: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: none;
    border: 0;
    transform: none !important;
  }
  .editor-wrap .ed-drawer-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: #fff;
  }
  .editor-wrap .ed-drawer-title {
    font-size: 15px;
    font-weight: 500;
  }
  .editor-wrap .ed-drawer-close {
    width: 36px;
    height: 36px;
    font-size: 20px;
    border: 0;
    background: transparent;
    color: var(--ink-2);
  }
  .editor-wrap .ed-drawer-body {
    flex: 1;
    overflow: auto;
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
  }
  .editor-wrap .ed-drawer-body textarea,
  .editor-wrap .ed-drawer-body input[type="text"] {
    width: 100%;
    font-size: 16px;
  }

  /* =========================================================================
     Phase 3 · 非编辑器页面适配
     ========================================================================= */

  /* ============ P3.1 顶部导航栏 ============ */
  .site-nav-container .navbar {
    padding: 8px 12px !important;
    gap: 4px !important;
    flex-wrap: nowrap !important;
  }
  .navbar-brand .brand-text {
    display: none;  /* 省空间：只留 logo */
  }
  .navbar-brand .logo {
    height: 32px !important;
  }
  /* 手机端：保留首页（第 1）+ 最后 3 项（我的 / 新建 / 登录或用户菜单）
     隐藏中间产品链接（相册书/日记书/朝花书/晒单） */
  .navbar-nav .nav-item:not(:first-child):not(:nth-last-child(-n+3)) {
    display: none !important;
  }
  .navbar-nav {
    gap: 2px !important;
    flex-wrap: nowrap !important;
    margin-left: auto;
  }
  .nav-link {
    padding: 6px 10px !important;
    font-size: 13px !important;
  }
  .nav-item .btn-primary {
    padding: 6px 12px !important;
    font-size: 13px !important;
  }
  .nav-user-name {
    max-width: 60px !important;
    font-size: 12px !important;
  }
  .nav-auth {
    gap: 2px !important;
    margin-left: 0 !important;
  }
  .nav-auth .nav-link {
    padding: 5px 8px !important;
    font-size: 12px !important;
  }

  /* ============ P3.2 站点底部 ============ */
  .site-footer {
    padding: 30px 0 20px !important;
  }
  .site-footer h5 {
    font-size: 14px !important;
    margin-bottom: 10px !important;
  }
  .site-footer a {
    padding: 4px 0 !important;
    font-size: 13px !important;
    display: block;
  }
  .site-footer .footer-bottom {
    font-size: 11px !important;
    padding: 16px 12px 0 !important;
    line-height: 1.8 !important;
  }

  /* ============ P3.3 首页 hero 已在 main.css 有 767 规则，此处补充 ============ */
  .hero-slide .hero-title {
    font-size: 22px !important;
    letter-spacing: 1px !important;
  }
  .hero-slide .hero-sub,
  .hero-slide .hero-caption {
    font-size: 12px !important;
    letter-spacing: 1px !important;
  }

  /* ============ P3.4 登录/注册表单 ============ */
  .auth-wrap,
  .auth-page {
    padding: 20px 16px !important;
    min-height: 100vh;
  }
  .auth-card {
    width: 100% !important;
    max-width: 100% !important;
    padding: 24px 20px !important;
    border-radius: 10px !important;
  }
  .auth-card h1,
  .auth-card h2 {
    font-size: 18px !important;
    margin-bottom: 8px !important;
  }
  .auth-card input[type="text"],
  .auth-card input[type="email"],
  .auth-card input[type="password"] {
    font-size: 16px !important;  /* 避免 iOS 自动缩放 */
    padding: 10px 12px !important;
  }
  .auth-card .btn,
  .auth-card button[type="submit"] {
    width: 100%;
    padding: 12px !important;
    font-size: 15px !important;
  }

  /* ============ P3.5 书架页（BookShelfView · .bs-* 类） ============ */
  .page-header h1 {
    font-size: 20px !important;
  }
  .page-header .btn {
    padding: 6px 12px !important;
    font-size: 13px !important;
  }
  .filter-bar {
    overflow-x: auto;
    flex-wrap: nowrap !important;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .filter-bar::-webkit-scrollbar { display: none; }
  .filter-chip {
    flex-shrink: 0;
    padding: 5px 12px !important;
    font-size: 12px !important;
    white-space: nowrap;
  }
  /* 书架卡片强制 2 列 */
  .bs-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
  .bs-card {
    border-radius: 6px !important;
  }
  .bs-title {
    font-size: 13px !important;
  }
  .bs-date {
    font-size: 11px !important;
  }
  .bs-actions .btn {
    padding: 4px 6px !important;
    font-size: 12px !important;
  }

  /* ============ P3.6 新建书籍页（CreateView） ============ */
  .create-page {
    padding: 16px 12px !important;
  }
  .create-hero {
    padding: 16px 10px !important;
  }
  .create-hero h1 {
    font-size: 20px !important;
  }
  .create-hero .page-sub {
    font-size: 13px !important;
  }
  .type-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  .type-card {
    padding: 14px 10px !important;
  }
  .type-card .tc-name {
    font-size: 14px !important;
  }
  .type-card .tc-desc {
    font-size: 11px !important;
  }
  .type-card .tc-meta {
    font-size: 10px !important;
  }
  .type-card .tc-cta {
    font-size: 12px !important;
  }
  .type-card .tc-icon {
    font-size: 32px !important;
  }

  /* ============ P3.7 产品/展示页 ============ */
  .product-page .product-hero,
  .exhibition-page .ex-hero {
    padding: 20px 14px !important;
  }
  .product-hero h1 {
    font-size: 22px !important;
  }

  /* ============ P3.8 分享落地页 ============ */
  .share-landing {
    padding: 20px 12px !important;
  }
  .share-card .preview-col {
    padding: 20px !important;
    min-height: 220px !important;
  }
  .share-card .preview-col .mini-cover-wrap {
    width: 160px !important;
  }
  .share-card .info-col {
    padding: 20px !important;
    gap: 10px !important;
  }

  /* ============ P3.9 通用 section head / container 压缩 ============ */
  .container {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  .section-head {
    padding: 24px 0 12px !important;
  }
  .section-head h1 {
    font-size: 18px !important;
    letter-spacing: 2px !important;
  }

  /* ============ P3.10 通用按钮触控尺寸 ============ */
  .btn {
    min-height: 38px;
  }

  /* ============ P3.11 预览翻书（PreviewView） ============ */
  .preview-view {
    padding: 10px !important;
  }
  .preview-view .pv-top {
    top: 10px !important;
    left: 10px !important;
    right: 10px !important;
    font-size: 13px;
  }
  .preview-view .pv-top .btn {
    padding: 5px 12px !important;
    font-size: 12px !important;
    min-height: 32px !important;
  }
  .preview-view .pv-page {
    width: var(--pv-page-w, min(92vw, 380px)) !important;
    height: var(--pv-page-h, auto) !important;
    aspect-ratio: 640 / 906;
    max-height: none;
    flex: 0 0 auto;
  }
  .preview-view .pv-nav {
    width: 36px !important;
    height: 36px !important;
    font-size: 22px !important;
  }
  .preview-view .pv-bottom {
    bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .preview-view .pv-bottom .idx {
    padding: 5px 10px !important;
    font-size: 12px !important;
  }

  .check-view {
    padding: 18px 12px calc(88px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .check-head {
    display: block !important;
    margin-bottom: 14px !important;
  }
  .check-head h1 {
    font-size: 24px !important;
  }
  .check-head p {
    font-size: 12px !important;
  }
  .check-stats {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 6px !important;
    margin-top: 14px !important;
  }
  .check-stats div {
    padding: 10px 4px !important;
    border-radius: 12px !important;
  }
  .check-stats b {
    font-size: 18px !important;
  }
  .check-stats span {
    font-size: 11px !important;
  }
  .check-card,
  .check-tips {
    padding: 14px !important;
    border-radius: 14px !important;
  }
  .check-issue {
    grid-template-columns: 44px 1fr !important;
    gap: 10px !important;
    padding: 12px !important;
  }
  .issue-media {
    width: 44px !important;
    height: 44px !important;
    border-radius: 10px !important;
  }
  .check-issue .btn {
    grid-column: 2 !important;
    justify-self: flex-start !important;
    min-height: 32px !important;
  }
  .check-actions {
    position: fixed !important;
    left: 10px !important;
    right: 10px !important;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px)) !important;
    margin: 0 !important;
    padding: 10px !important;
    border-radius: 14px !important;
  }
  .check-actions .btn {
    flex: 1 !important;
    padding: 9px 10px !important;
    font-size: 12px !important;
    letter-spacing: 0 !important;
  }

  .print-view {
    padding: 10px 8px 28px !important;
  }
  .print-toolbar {
    position: sticky !important;
    top: 8px !important;
    display: block !important;
    margin-bottom: 12px !important;
    padding: 12px !important;
    border-radius: 16px !important;
  }
  .print-toolbar h1 {
    font-size: 20px !important;
  }
  .print-toolbar p {
    font-size: 12px !important;
  }
  .print-toolbar-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px !important;
    margin-top: 12px !important;
  }
  .print-toolbar-actions .btn {
    min-height: 38px !important;
    padding: 8px 10px !important;
    font-size: 12px !important;
  }
  .print-toolbar-actions .btn-primary {
    grid-column: 1 / -1;
  }
  .print-notice {
    margin-bottom: 12px !important;
    font-size: 12px !important;
  }
  .print-pages {
    gap: 14px !important;
    padding-bottom: 20px !important;
  }
  .print-sheet {
    width: 100% !important;
    box-sizing: border-box !important;
    border-radius: 14px !important;
    padding: 34px 8px 14px !important;
  }
  .print-sheet-label {
    left: 12px !important;
    top: 10px !important;
    font-size: 11px !important;
  }
  .print-copyright {
    padding: 70px 36px 48px !important;
  }
  .print-copyright h2 {
    margin-bottom: 28px !important;
  }
  .print-copyright-body {
    gap: 10px !important;
    margin-bottom: 24px !important;
  }
  .print-copyright-body div {
    grid-template-columns: 68px 1fr !important;
    gap: 8px !important;
    font-size: 12px !important;
  }

}  /* end @media (max-width: 768px) */
