/* ==========================================================================
   小面包拼豆 · 手机端适配层（2026-11-15）
   加载顺序：必须在 style.css / outbound.css / skin.css / desktop-layout.css /
   bead-mix.css / header-tabs.css 之后，靠层叠覆盖，不改任何原文件。
   设计原则：
   1) 布局类规则用纯 @media，不依赖 JS；JS 挂了也不会回到桌面三栏。
   2) 交互增强类规则用 body.mob，由 js/mobile.js 在窄屏添加。
   3) 桌面端（≥768px）本文件 0 条规则生效。
   ========================================================================== */

@media (max-width: 767px) {
  :root {
    --mob-tab-h: 58px;
    --mob-safe: env(safe-area-inset-bottom, 0px);
    --mob-safe-top: env(safe-area-inset-top, 0px);
  }

  html, body { max-width: 100%; overflow-x: hidden; }
  * { -webkit-tap-highlight-color: rgba(102, 126, 234, .18); }

  /* 底部 Tab 给内容留位，避免最后一个按钮被 Home 指示条盖住 */
  body { padding-bottom: calc(var(--mob-tab-h) + var(--mob-safe)) !important; }
  body.mix-mode { padding-bottom: 0 !important; }

  /* ---------- 顶栏：只留标题 + 激活徽章，模式切换交给底部大 Tab ----------
     原样式 height:52px + overflow:hidden 会把标题/徽章截断，且吸顶预览 top:44px
     会与 52px 顶栏重叠 8px；这里把两者统一到 46px 并放开溢出。 */
  .header {
    height: 46px !important; min-height: 46px;
    padding: 5px 10px !important; gap: 6px;
    overflow: visible !important; box-sizing: border-box;
  }
  .header h1 { font-size: 15px !important; white-space: nowrap; }
  .header-left { flex: 1 1 auto; min-width: 0; }
  .header-right { margin-left: auto; flex: 0 0 auto; }
  .license-badge { gap: 4px; }
  .license-btn { min-height: 36px; padding: 4px 10px; }
  body.mob .header .mode-switcher { display: none !important; }

  /* ---------- 底部模式 Tab（由 js/mobile.js 创建） ---------- */
  .mob-tabs {
    position: fixed; left: 0; right: 0; bottom: 0;
    z-index: 1200;
    display: flex; align-items: stretch;
    height: calc(var(--mob-tab-h) + var(--mob-safe));
    padding-bottom: var(--mob-safe);
    background: #fff;
    border-top: 1px solid #e6e3ee;
    box-shadow: 0 -6px 18px rgba(36, 33, 43, .08);
  }
  .mob-tab {
    flex: 1 1 0; min-width: 0; min-height: 44px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; border: 0; background: transparent;
    color: #6d6879; font-size: 11px; line-height: 1.2;
    cursor: pointer; padding: 4px 2px;
  }
  .mob-tab .mob-ic { font-size: 19px; line-height: 1; }
  .mob-tab.active { color: #5b4bd6; font-weight: 700; }
  .mob-tab.active::before {
    content: ''; position: absolute; top: 0;
    width: 34px; height: 3px; border-radius: 0 0 3px 3px; background: #5b4bd6;
  }
  body.mob-modal-open .mob-tabs { display: none !important; }

  /* ---------- 主内容：单栏垂直流，参数卡片不再挤成两栏 ---------- */
  .main-layout { max-width: none !important; padding: 10px 10px 18px !important; }
  .main-layout > .right-panel { width: 100% !important; max-width: none !important; }
  .card { padding: 14px !important; margin-bottom: 10px !important; border-radius: 12px; }
  .card-title { font-size: 13px; }
  /* 桌面预览由吸顶预览承担，避免同一张图出现两遍、把参数推到屏幕外 */
  /* 上传卡片真实位置是 .left-panel > .preview-sticky > #uploadSection，
     不是 .left-panel 的直接子元素。
     上一版写成 .left-panel > *:not(#uploadSection)，命中的是 .preview-sticky 这层容器，
     把上传卡片连带容器一起藏掉，手机端因此始终没有上传入口（2026-11-15 线上实测确认）。
     这一版按「卡片」粒度过滤：只放行 #uploadSection，其余卡片继续隐藏。 */
  body.mob:not(.mix-mode):not(.ob-mode) .main-layout > .left-panel {
    display: block !important; width: 100% !important; max-width: none !important;
    max-height: none !important; position: static !important;
  }
  body.mob:not(.mix-mode):not(.ob-mode) .main-layout > .left-panel .card:not(#uploadSection) {
    display: none !important;
  }
  /* .preview-sticky 在手机端只剩上传卡片一个孩子：复位成普通块，去掉吸顶 / 内边距 / 阴影 */
  body.mob:not(.mix-mode):not(.ob-mode) .main-layout > .left-panel .preview-sticky {
    display: block !important; position: static !important; top: auto !important;
    padding: 0 !important; margin: 0 !important; overflow: visible !important;
    max-height: none !important; height: auto !important;
    background: none !important; box-shadow: none !important; border: 0 !important;
    -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
  }
  /* 注意：这里绝不能再给 #uploadSection 加 display:block !important。
     上传成功后 app.js 会写内联 display:none 把上传卡片换成预览，
     用 !important 强行显示会让上传框在预览阶段一直挂在页面中间。 */
  /* 原 file input 是 display:none 靠 JS click 触发，iOS / 微信内置浏览器常失效；
     改成透明覆盖上传区，用原生点击拉起相册/相机（mobile.js 会阻止冒泡避免二次触发）。 */
  body.mob .upload-area { position: relative; min-height: 96px; padding: 18px 12px; }
  body.mob .upload-area input[type="file"] {
    display: block !important; position: absolute; inset: 0;
    width: 100%; height: 100%; opacity: 0; cursor: pointer;
    font-size: 16px; z-index: 2;
  }
  body.mob .upload-area .upload-icon { font-size: 30px; margin-bottom: 4px; }

  /* 触控：按钮最小 44px，输入框 16px 防 iOS 自动放大 */
  button, .btn, .size-option, .style-preset, .crop-ratio-btn,
  .mobile-action-btn, .mobile-tool-btn, .zoom-mode-tab, .sticker-tab {
    min-height: 44px;
  }
  button { touch-action: manipulation; }
  input[type="text"], input[type="number"], input[type="search"], select, textarea {
    font-size: 16px !important;
  }
  input[type="range"] { height: 34px; touch-action: pan-y; }
  .size-row { gap: 8px !important; }
  .size-field input { min-width: 0; }

  /* 说明文字收进「？」折叠，不再占首屏（对应「只留按钮」） */
  body.mob .card { position: relative; }
  .tip, .hint, .form-help, .crop-info, .upload-hint { font-size: 11px; line-height: 1.45; }
  body.mob .card > .tip,
  body.mob .card > .hint,
  body.mob .card > .form-help,
  body.mob .card .upload-hint,
  body.mob .ob-card > .tip { display: none; }
  body.mob .card.mob-hint-open > .tip,
  body.mob .card.mob-hint-open > .hint,
  body.mob .card.mob-hint-open > .form-help,
  body.mob .card.mob-hint-open .upload-hint,
  body.mob .ob-card.mob-hint-open > .tip { display: block !important; }
  .mob-hint-btn {
    position: absolute; right: 10px; top: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 32px; min-height: 32px; border: 0; border-radius: 50%;
    background: #f1eff7; color: #5b4bd6; font-size: 13px;
  }

  /* 预览 / 参数快速跳转：单栏长页面不用一路往下翻 */
  .mob-quick {
    position: fixed; right: 10px;
    bottom: calc(var(--mob-tab-h) + var(--mob-safe) + 12px);
    z-index: 1150; display: flex; flex-direction: column; gap: 6px;
  }
  .mob-quick-btn {
    min-width: 66px; min-height: 36px; padding: 4px 8px;
    border: 1px solid #e2dfec; border-radius: 999px;
    background: rgba(255,255,255,.96); color: #5b4bd6;
    font-size: 11px; box-shadow: 0 3px 10px rgba(36,33,43,.12);
  }
  body.mix-mode .mob-quick,
  body.ob-mode .mob-quick,
  body.mob-modal-open .mob-quick { display: none; }

  /* ---------- 吸顶预览：默认显示，但可一键收起，不再吃掉半屏 ----------
     top 必须等于顶栏高度；原 slider 40vh + toolbar 40px 在 667px 屏上占 57%。 */
  #mobilePreview { top: calc(46px + var(--mob-safe-top)) !important; }
  .mobile-preview-slider {
    height: 28vh !important;
    max-height: 200px !important;
    min-height: 150px !important;
  }
  .mob-preview-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 100%; min-height: 30px; border: 0; background: #f7f6fa;
    color: #6d6879; font-size: 11px; letter-spacing: .5px;
  }
  body.mob-preview-collapsed #mobilePreview .mobile-preview-slider,
  body.mob-preview-collapsed #mobilePreview .mobile-preview-stats { display: none !important; }
  .mobile-preview-tabs { margin-top: 6px !important; }
  .mobile-preview-toolbar { flex-wrap: wrap; gap: 6px; }
  .mobile-tool-switch { min-height: 40px; }
  .mobile-bg-btn { min-width: 40px; min-height: 40px; }

  /* ---------- 底部导出栏：抬到 Tab 之上 ---------- */
  .bottom-bar {
    bottom: calc(var(--mob-tab-h) + var(--mob-safe)) !important;
    padding: 8px 10px !important;
    z-index: 1100;
  }
  .export-btn { min-height: 46px; font-size: 14px; }
  body.mob-modal-open .bottom-bar { display: none !important; }

  /* ---------- 裁切弹窗：全屏、确认吸底、比例按钮可横滚但不藏按钮 ---------- */
  .crop-modal, .zoom-modal, .brush-overlay, .export-modal { z-index: 2000 !important; }
  .crop-header, .zoom-header, .export-modal-header { min-height: 50px; padding: 6px 10px; }
  .crop-close, .crop-confirm, .zoom-close, .export-modal-close { min-width: 52px; min-height: 44px; }
  .crop-adjust-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 2px 10px !important; }
  .crop-adjust-row label { width: 38px !important; font-size: 11px !important; }
  .crop-adjust-row b { width: 24px !important; }
  .crop-footer { flex-wrap: wrap; gap: 6px; padding: 8px 10px calc(8px + var(--mob-safe)); }
  .crop-ratio-switch { width: 100%; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .crop-ratio-btn { flex: 0 0 auto; white-space: nowrap; }
  /* 原手柄只有 24px，手指按不准；放大到 40px 并同步挪动四角偏移 */
  .crop-handle { width: 40px !important; height: 40px !important; }
  .crop-handle::before { content: ''; position: absolute; inset: -6px; }
  .crop-handle-tl { top: -20px !important; left: -20px !important; }
  .crop-handle-tr { top: -20px !important; right: -20px !important; }
  .crop-handle-bl { bottom: -20px !important; left: -20px !important; }
  .crop-handle-br { bottom: -20px !important; right: -20px !important; }
  /* 触摸拖框时不要让页面跟着滚 */
  .crop-canvas-wrap, .crop-box { touch-action: none; }

  /* ---------- 大图改色：右侧栏改底部抽屉，原图对照保持可见 ----------
     2026-11-25 反馈⑤：抽屉最多占屏幕 1/4 高，画布保持原尺寸不被挤小 */
  .zoom-color-panel {
    top: auto !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    width: 100% !important;
    max-height: 25vh;
    transform: translateY(100%) !important;
    border-radius: 16px 16px 0 0 !important;
    border-left: 0 !important;
    border-top: 1px solid rgba(0,0,0,.1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(10px + var(--mob-safe));
    z-index: 1005;
  }
  .zoom-color-panel.active { transform: translateY(0) !important; }
  /* 抽屉是 flex column：内容一多，flex 会把色号网格压成几像素、把「选择色号」压成 0×0，
     手机端就出现「工具栏点不到 / 改不了色」。这里禁止子项收缩，让抽屉自己滚。 */
  .zoom-color-panel > * { flex: 0 0 auto !important; }
  .zoom-colors-grid { min-height: 84px; align-content: start; }
  .zoom-color-title { font-size: 12px; margin: 2px 0; }
  .zoom-batch-hint { font-size: 11px; padding: 5px 8px; margin: 2px 0; }
  .zoom-clear-btn { min-height: 38px; }
  .zoom-panel-actions { margin-top: 4px; }
  /* 框选工具栏（2026-11-25 反馈⑥-2）：mobile.js 已把它移到模式 tab 之后，
     这里 sticky 钉在 tab 下方——一进框选模式，框大小/全选/清空/选择色号直接可见 */
  /* 原图对照框（反馈⑥-1）：比例跟随主画布视口/图纸，竖长图时限高防溢出 */
  .orig-pip-canvas { max-height: 36vh; object-fit: contain; }
  .zoom-color-panel .zoom-region-bar {
    position: sticky; top: 46px; z-index: 6;
    margin: 0 -10px 8px !important;
    padding: 8px 10px !important;
    background: #fff; border-bottom: 1px solid rgba(0,0,0,.08);
    box-shadow: 0 6px 14px rgba(0,0,0,.06);
    border-radius: 0 0 12px 12px;
  }
  .zoom-region-bar .zoom-region-feedback { font-size: 11px; line-height: 1.4; }
  .zoom-mode-tabs { position: sticky; top: 0; z-index: 3; background: inherit; }
  .zoom-colors-grid { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)) !important; }
  .zoom-colors-grid > * { min-height: 44px; }
  .zoom-panel-tools { flex-wrap: wrap; }
  .zoom-panel-tools input[type="text"] { flex: 1 1 120px; min-height: 40px; }
  .zoom-only-used { min-height: 40px; }
  .zoom-series-bar { flex-wrap: wrap; }
  .orig-pip {
    left: 8px !important; right: auto !important;
    top: 8px !important; bottom: auto !important;
    width: 112px !important; max-width: 34vw;
    z-index: 1006 !important;
  }
  .orig-pip-canvas { max-width: 100%; height: auto; }
  .orig-pip-toggle { min-width: 32px; min-height: 32px; }
  .zoom-canvas-wrap { touch-action: none; }
  .zoom-region-bar { flex-wrap: wrap; }
  .zoom-region-bar button { min-width: 64px; }
  /* 框选批量：尺寸 / 选择色号 / 反馈在底部抽屉里也要好按 */
  .zoom-region-bar { flex-direction: column !important; align-items: stretch !important; gap: 6px !important; }
  .zoom-region-row { flex-wrap: wrap; gap: 6px; }
  .zoom-region-row > span { flex: 1 1 100%; font-size: 11px; }
  .zoom-region-bar .zoom-region-size-btn,
  .zoom-region-bar .zoom-region-pick {
    min-height: 44px !important; font-size: 12px !important; padding: 6px 12px !important;
  }
  .zoom-region-bar .zoom-region-pick { flex: 1 1 100%; }
  .zoom-region-toast { top: calc(56px + var(--mob-safe-top)) !important; max-width: 88vw !important; }

  /* ---------- 涂抹笔：工具按钮加大、画布不吃滚动手势 ---------- */
  .brush-overlay canvas { touch-action: none; }
  .brush-tool-btn { min-width: 56px; min-height: 44px; }
  .brush-tool-panel { padding-bottom: calc(8px + var(--mob-safe)); flex-wrap: wrap; }
  .brush-top-btn { min-width: 56px; }
  .brush-cursor { pointer-events: none; }
  /* 触屏没有 hover，原 .brush-cursor 不会显示；用一个跟随手指的圆环替代 */
  .mob-brush-ring {
    position: fixed; z-index: 2100; display: none;
    border: 2px solid rgba(255,255,255,.95);
    box-shadow: 0 0 0 1px rgba(0,0,0,.55), inset 0 0 0 1px rgba(0,0,0,.35);
    border-radius: 50%; pointer-events: none;
    transform: translateZ(0);
  }

  /* ---------- 出库助手：表格横向滚动，Tab 可横滚但当前项可见 ---------- */
  #outbound-root.ob-embedded { padding: 0 10px calc(20px + var(--mob-tab-h)) !important; }
  .ob-embedded .ob-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .ob-embedded .ob-tab { flex: 0 0 auto; min-height: 44px; }
  .mob-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .mob-scroll > table { min-width: 560px; }
  .ob-embedded .ob-card { padding: 12px !important; }

  /* ---------- 拼豆剪贴簿 iframe：给底部 Tab 留出空间 ---------- */
  body.mix-mode #mixView { top: calc(46px + var(--mob-safe-top)) !important; bottom: calc(var(--mob-tab-h) + var(--mob-safe)) !important; }
  body.mix-mode #mixView iframe { height: 100% !important; }

  /* ---------- 保存 / 激活等弹窗 ---------- */
  .license-modal-content, .export-modal-body {
    max-width: calc(100vw - 24px) !important;
    max-height: 86vh;
    overflow-y: auto;
  }
  .export-img-wrap img { max-width: 100%; height: auto; }
  .app-version { display: none; }
}

/* 横屏矮屏：进一步压缩吸顶区与 Tab 高度 */
@media (max-width: 767px) and (max-height: 480px) {
  :root { --mob-tab-h: 46px; }
  .mob-tab .mob-ic { font-size: 16px; }
  .mobile-preview-slider { max-height: 38vh; }
  .zoom-color-panel { max-height: 68vh; }
}

/* ==========================================================================
   「图片生成」三段式布局（js/mobile-layout.js 生成 DOM，仅 ≤767px + free 模式）
   顶栏 mbl-topbar / 画布视口 mbl-stage / 底部 dock mbl-dock + 半屏面板 mbl-panel
   桌面端不加载这些类，行为零变化
   ========================================================================== */
@media (max-width: 767px) {
  :root { --mbl-dock-h: 96px; }

  /* 旧吸顶预览 / 底部导出栏 / 快捷悬浮：新布局接管后隐藏 */
  body.mbl-layout #mobilePreview { display: none !important; }
  body.mbl-layout.mbl-ready .bottom-bar { display: none !important; }
  body.mbl-layout.mbl-ready .mob-quick { display: none !important; }
  /* 上传后整页文档流让位给三段式固定布局 */
  body.mbl-layout.mbl-ready .main-layout { display: none !important; }
  body.mbl-layout.mbl-ready { overflow: hidden; }

  /* 空态（未上传）：整屏大上传引导，不显示顶栏/画布/dock */
  body.mbl-layout:not(.mbl-ready) .main-layout > .right-panel { display: none !important; }
  body.mbl-layout:not(.mbl-ready) .main-layout { display: block !important; padding-top: 4vh !important; }
  body.mbl-layout:not(.mbl-ready) #uploadSection { margin: 0 12px; }
  body.mbl-layout:not(.mbl-ready) .upload-area {
    min-height: 52vh;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
  }
  body.mbl-layout:not(.mbl-ready) .upload-area svg { width: 72px; height: 72px; }
  body.mbl-layout:not(.mbl-ready) .upload-area p { font-size: 15px; }

  /* ① 顶部薄栏：统计一行 + 小操作 + 生成按钮 */
  .mbl-topbar {
    position: fixed; z-index: 900; left: 0; right: 0;
    top: calc(46px + var(--mob-safe-top));
    height: 40px; box-sizing: border-box;
    display: none; align-items: center; gap: 6px; padding: 0 10px;
    background: var(--surface); border-bottom: 1px solid var(--line);
  }
  body.mbl-layout.mbl-ready .mbl-topbar { display: flex; }
  /* 顶栏左侧：原图/图纸胶囊（反馈③并入顶栏，不再悬浮可拖拽） */
  .mbl-topbar-left { flex: none; min-width: 0; display: flex; align-items: center; }
  /* 豆子颗数统计不再显示（反馈③） */
  .mbl-topbar #mobileStats { display: none !important; }
  .mbl-topbar-acts { flex: none; display: flex; gap: 4px; margin-left: auto; }
  .mbl-act-btn {
    height: 30px; padding: 0 10px !important;
    border-radius: 8px; font-size: 12px; line-height: 1; white-space: nowrap;
  }
  .mbl-act-btn .tool-icon { display: none; }
  .mbl-topbar #generateBtn {
    flex: none; width: auto; margin: 0; padding: 8px 14px; font-size: 12px;
  }

  /* ② 中部画布视口：接管 #mobileResultPreview 的 world 画布管线 */
  .mbl-stage {
    position: fixed; z-index: 880; left: 0; right: 0; overflow: hidden;
    top: calc(86px + var(--mob-safe-top));
    bottom: calc(var(--mob-tab-h) + var(--mob-safe) + var(--mbl-dock-h));
    display: none; background: var(--bench);
  }
  body.mbl-layout.mbl-ready .mbl-stage { display: block; }
  .mbl-stage #mobileResultPreview {
    position: absolute; left: 0; top: 0; right: 0; bottom: 0;
    width: 100%; height: 100%; overflow: hidden;
  }
  /* #mobileResultPreview 自带 .mobile-preview-content 类，style.css 的
     canvas 定位规则搬家后仍生效；这里等价补一份兜底 */
  .mbl-stage #mobileResultPreview > canvas {
    position: absolute; left: 0; top: 0;
    max-width: none; max-height: none; transform-origin: 0 0;
  }
  /* 定位按钮移除（2026-11-25 反馈②）：画布固定 1:1 格宽，平移即可找回图纸 */
  .mbl-stage #mobileResultPreview .pv-locate-btn { display: none !important; }

  /* 原图层：与图纸同一 transform，手势穿透给下层画布容器 */
  .mbl-orig-layer {
    position: absolute; left: 0; top: 0; right: 0; bottom: 0;
    overflow: hidden; pointer-events: none; display: none; z-index: 3;
  }
  .mbl-orig-img {
    position: absolute; left: 0; top: 0;
    transform-origin: 0 0; max-width: none;
  }

  /* 胶囊：原图 | 图纸（顶栏内联，不再悬浮/拖拽） */
  .mbl-pill {
    display: none; flex: none; position: static;
    padding: 3px; border-radius: 999px;
    background: rgba(255, 255, 255, .92);
    border: 1px solid var(--line); box-shadow: var(--sh-1);
    user-select: none; -webkit-user-select: none;
  }
  body.mbl-layout.mbl-ready .mbl-pill { display: flex; }
  .mbl-pill-seg {
    border: none; background: transparent; cursor: pointer;
    padding: 5px 12px; border-radius: 999px;
    font-size: 12px; font-weight: 600; color: var(--ink-2);
    font-family: inherit;
  }
  .mbl-pill-seg.active { background: var(--cta); color: var(--cta-fg); }

  /* ③ 底部 dock：chip 开关行 + 面板 tab 行 */
  .mbl-dock {
    position: fixed; z-index: 950; left: 0; right: 0;
    bottom: calc(var(--mob-tab-h) + var(--mob-safe));
    box-sizing: border-box; padding: 6px 8px;
    display: none; flex-direction: column;
    background: var(--surface); border-top: 1px solid var(--line);
  }
  body.mbl-layout.mbl-ready .mbl-dock { display: flex; }
  .mbl-chips {
    display: flex; align-items: center; gap: 10px;
    overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 6px;
  }
  .mbl-chips .mobile-tool-switch { flex: none; flex-direction: row; gap: 4px; }
  .mbl-chips .mobile-tool-switch span { font-size: 10px; }
  .mbl-chips .switch--sm { width: 34px; height: 20px; flex: none; }
  .mbl-chips .switch--sm::after { width: 16px; height: 16px; }
  .mbl-chips .switch--sm.active::after { transform: translateX(14px); }
  .mbl-chips .mobile-bg-switcher { flex: none; flex-direction: row; gap: 4px; }
  .mbl-chips .mobile-bg-btn { padding: 3px 8px; font-size: 10px; }

  .mbl-tabs-row {
    display: flex; gap: 4px;
    border-top: 1px solid var(--line); padding-top: 6px;
  }
  .mbl-tab {
    flex: 1; cursor: pointer; font-family: inherit;
    border: 1px solid var(--line); border-radius: 10px;
    background: var(--surface); padding: 7px 0;
    font-size: 11px; font-weight: 600; color: var(--ink-2);
  }
  .mbl-tab.active { background: var(--cta); border-color: var(--cta-deep); color: var(--cta-fg); }

  /* ④ 悬浮面板（2026-11-25 反馈①）：高度压到 30vh、悬浮在 dock 上方，
     画布保持完整可见不被挤压；再点 tab、点画布、下滑手势收起 */
  .mbl-panel {
    position: fixed; z-index: 940; left: 8px; right: 8px;
    bottom: calc(var(--mob-tab-h) + var(--mob-safe) + var(--mbl-dock-h) + 8px);
    height: 20vh; box-sizing: border-box;
    border: 1px solid var(--line); border-radius: 16px;
    display: none; flex-direction: column;
    background: var(--surface);
    box-shadow: 0 8px 28px rgba(15, 23, 42, .18);
    transform: translateY(100%); opacity: 0; pointer-events: none;
    transition: transform .22s ease, opacity .22s ease;
  }
  body.mbl-layout.mbl-ready .mbl-panel { display: flex; }
  .mbl-panel.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .mbl-panel-head { flex: none; display: flex; justify-content: center; padding: 8px 0 4px; cursor: pointer; }
  .mbl-panel-grip { width: 44px; height: 4px; border-radius: 2px; background: var(--line); }
  .mbl-panel-body {
    flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 4px 14px 18px;
  }
  .mbl-sec { display: none; }
  .mbl-sec.on { display: block; }
  /* 反馈④：面板内只留按钮和选项，说明性文字（.tip）一律隐藏 */
  .mbl-panel .tip { display: none !important; }
  /* 面板内控件再紧凑一档：表单组间距、卡片标题字号 */
  .mbl-panel .form-group { margin-bottom: 10px; }
  .mbl-panel .card-title { font-size: 12px; margin-bottom: 6px; }
  .mbl-sec .form-group { margin-bottom: 14px; }
  .mbl-sec .form-group:last-child { margin-bottom: 0; }
  .mbl-sec .card { margin-bottom: 12px; border: 1px solid var(--line); box-shadow: none; }
  .mbl-sec .card:last-child { margin-bottom: 0; }
  .mbl-sec .card-header { padding: 10px 12px; }
  .mbl-sec .card-body { padding: 10px 12px; }
  .mbl-sec .bg-model-loading { margin-left: 0; margin-top: 6px; }

  /* 导出面板：激活徽章 + 导出按钮 */
  .mbl-sec[data-sec="export"] .license-badge { margin-right: 0; margin-bottom: 10px; }
  .mbl-sec[data-sec="export"] #exportBtn { width: 100%; }

  /* 涂色提示 toast */
  .mbl-toast {
    position: fixed; z-index: 1200; left: 50%; bottom: 42%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, .85); color: #fff;
    font-size: 12px; padding: 8px 14px; border-radius: 10px;
    opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .mbl-toast.show { opacity: 1; }
}
