/* ================================================================
   Script Atelier — 手机端全局重塑 (shared/mobile.css)
   设计原则：
   1. 顶栏：品牌+汉堡菜单，桌面级多链接收进抽屉；右侧只留头像/主题
   2. 底栏：固定底部 tab（导航 + 当前模式工具栏二选一，各页自决）
   3. 多栏布局全变单栏；隐藏的侧栏改抽屉/底部弹层按需唤出
   4. 触控目标 ≥44px；输入 16px 防 iOS 缩放
   5. 固定满屏工作台（ws-page）保留内部滚动，其余放开整页滚动
   6. 字号下限：正文 ≥15px，标签 ≥13px，不靠 !important 砸碎既有层级
   加载顺序：所有页面在自身 css 之后引入本文件。
   ================================================================ */

/* ════════════════════════════════════════════════════════════════
   0. 基础：滚动 / 高度 / 安全区
══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root {
    --nav-h: 50px;
    --tab-h: calc(62px + env(safe-area-inset-bottom, 0px));
  }

  html, body {
    overflow: auto !important;
    height: auto !important;
    min-height: 100vh;
    -webkit-text-size-adjust: 100%;
  }
  /* 工作台保留满屏内部滚动；其余放开整页滚动 */
  body.ws-page, body.dv-on, body.ld-on, body.fm-on, body.ig-on, body.ad-on {
    overflow: hidden !important;
    height: 100dvh !important;
  }
  /* 兜底：非工作台的普通滚动页（首页/作品库/账号等），确保 html/body 可滚 */
  html { overflow: auto !important; }

  /* Narrow screens must become usable immediately. Some embedded browsers
     expose a fine pointer even at phone width, so pointer-only overrides leave
     a full-page route curtain visible during the first paint. */
  body.sa-route-enter, body.sa-route-leave { animation: none !important; filter: none !important; opacity: 1 !important; transform: none !important; }
  body.home-page.page-enter::before { display: none !important; }
  body.home-page.home-authed .workspace { animation: none !important; opacity: 1 !important; transform: none !important; filter: none !important; }
  .sa-route-bar { display: none !important; }

  /* ── 性能封禁：只对真正的触屏手机关掉最贵的合成层 ──
     窄的电脑窗口仍是 fine pointer，不应丢失胶片颗粒、模糊和路由动效。 */
  @media (pointer: coarse) {
    /* 1) 全屏胶片颗粒：fixed + SVG turbulence 滤镜 = 头号卡顿源 */
    body::after { display: none !important; }
    /* 2) 顶栏/底栏/弹窗的 backdrop-filter 模糊：滚动时逐帧重绘极贵 → 改纯色 */
    .sa-nav, .sa-nav.is-scrolled, .sa-tabs,
    .sa-modal-overlay, .sa-auth-issue, .sa-confirm-wrap,
    .sa-drawer-mask, .m-panel-fab {
      backdrop-filter: none !important;
      -webkit-backdrop-filter: none !important;
    }
    .sa-nav, .sa-nav.is-scrolled { background: var(--bg-mid) !important; }
    .sa-tabs { background: var(--bg-mid) !important; }
    /* 3) 关掉平滑滚动（手机上会卡顿动画化）+ 路由切换的 blur 滤镜动画 */
    html { scroll-behavior: auto !important; }
  }
  /* 4) 触摸滚动顺滑 + 防滚动链穿到 body */
  .dv-body, .cmsgs, .ld-chatlog, .ld-form, .ld-paper, .ld-editor,
  .fm-view, .fm-chatlog, .fm-script, .ig-chatlog, .ig-stage, .ig-scriptedit,
  .center-body, .writing-area, .right-body, .chapter-list, .story-state-panel,
  .v3w-script, .ad-ep-nav, .ig-rpanel, .ig-cast, .ig-eplist {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    min-height: 0;
  }

  /* 全局内边距收紧 */
  .sa-page { padding-top: var(--nav-h) !important; }
  .sa-page-mobile { padding-bottom: calc(var(--tab-h) + 12px) !important; }

  /* iOS 防缩放：所有输入 16px（只对真正会聚焦的元素，不破坏视觉大小靠 zoom=1） */
  input[type="text"], input[type="email"], input[type="password"],
  input[type="number"], input[type="search"], input[type="tel"], input[type="url"],
  input[type="date"], input[type="time"], textarea, select {
    font-size: 16px !important;
  }

  /* 触控目标 */
  button, .btn, .btn-sm, .btn-primary, .btn-ghost, .btn-danger,
  .ai-btn, .tool-btn, .ld-btn, .fm-btn, .ig-btn, .ad-btn,
  .sopt, .copt, .dv-chip, .ld-opt, .ig-opt,
  .phase-btn, .dv-phase-btn, .ld-step, .fm-step, .ad-step, .ig-stepnav,
  .sa-tab {
    min-height: 42px;
  }
  /* 工具栏小图标按钮例外 */
  .tool-btn, .hbtn, .cbtn, .lp-hd button,
  .sa-nav-link, .write-mode-select {
    min-height: 36px;
  }
}

/* ════════════════════════════════════════════════════════════════
   1. 顶部导航 sa-nav — 手机端精简
══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) and (pointer: coarse), (max-width: 768px) and (hover: none) {
  .sa-nav {
    height: var(--nav-h);
    padding: 0 14px;
    gap: 8px;
  }
  .sa-nav.is-scrolled { height: var(--nav-h); padding: 0 14px; }
  .sa-nav.is-idle.is-scrolled:not(:focus-within):not(:hover) { transform: none; }
  /* 隐藏中间链接与品牌全名，靠汉堡菜单展开 */
  .sa-nav-links { display: none !important; }
  .sa-nav-name { display: none !important; }
  .sa-nav-brand { margin-right: auto; gap: 7px; }
  .sa-nav-mark { font-size: 20px; }
  /* 手机端账号入口统一放到底部“我的”和抽屉，避免登录后顶部仍残留登录按钮造成重复与误解。 */
  .sa-auth-slot { display: none !important; }
  .sa-nav-right { gap: 6px; }
  .sa-user-text, .sa-user-role { display: none !important; }
  .sa-admin-link { padding: 0 10px; font-size: 11px; min-height: 32px; }
  .sa-logout-btn { display: none !important; }   /* 退出移到我的页 */
  .sa-theme-btn,
  .sa-nav-menu {
    width: 44px;
    height: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--line-md);
    border-radius: 10px;
    color: var(--ink-dim);
    background: color-mix(in srgb, var(--bg-mid) 72%, transparent);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.38);
    -webkit-tap-highlight-color: transparent;
  }
  .sa-theme-label { display: none; }

  /* 汉堡菜单按钮（由 nav.js 注入 .sa-nav-menu） */
  .sa-nav-menu {
    cursor: pointer;
  }
  .sa-theme-btn:hover,
  .sa-nav-menu:hover {
    color: var(--ink-dim);
    border-color: var(--line-md);
    background: color-mix(in srgb, var(--bg-mid) 72%, transparent);
  }
  .sa-theme-btn:focus-visible,
  .sa-nav-menu:focus-visible {
    outline: none;
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 34%, var(--line-md));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent), inset 0 1px 0 rgba(255,255,255,.42);
  }
  .sa-theme-btn:active,
  .sa-nav-menu:active {
    transform: scale(.94);
    color: var(--accent);
    background: var(--accent-glow);
  }
  .sa-theme-btn svg,
  .sa-nav-menu svg { width: 17px; height: 17px; }

  /* 抽屉遮罩 */
  .sa-drawer-mask {
    position: fixed; inset: 0; z-index: 140;
    background: rgba(0,0,0,.5); backdrop-filter: blur(4px);
    opacity: 0; pointer-events: none; transition: opacity .22s var(--ease);
  }
  .sa-drawer-mask.open { opacity: 1; pointer-events: auto; }
  /* 抽屉本体 */
  .sa-drawer {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 141;
    width: min(82vw, 320px);
    background: var(--bg-mid);
    border-left: 1px solid var(--line-md);
    box-shadow: -16px 0 50px rgba(0,0,0,.4);
    transform: translateX(100%);
    transition: transform .28s cubic-bezier(.22,1,.36,1);
    display: flex; flex-direction: column;
    padding: 16px 14px calc(var(--tab-h) + 16px);
    overflow-y: auto;
  }
  .sa-drawer.open { transform: translateX(0); }
  .sa-drawer-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line);
  }
  .sa-drawer-head b { font-family: var(--font-m); font-size: 11px; letter-spacing: .2em; color: var(--accent); text-transform: uppercase; }
  .sa-drawer-close {
    width: 44px; height: 44px; border-radius: var(--r);
    background: transparent; border: 1px solid var(--line-md);
    color: var(--ink-dim); font-size: 18px; cursor: pointer;
  }
  .sa-drawer a,
  .sa-drawer button[data-theme-toggle] {
    display: flex; align-items: center; gap: 12px;
    padding: 13px 12px; border-radius: var(--r);
    font-family: var(--font-s); font-size: 15px; color: var(--ink);
    text-decoration: none; min-height: 48px; width:100%;
    border: 1px solid transparent; transition: background .15s;
    background:transparent; text-align:left; cursor:pointer;
  }
  .sa-drawer a:active, .sa-drawer a:hover,
  .sa-drawer button[data-theme-toggle]:active,
  .sa-drawer button[data-theme-toggle]:hover { background: var(--accent-glow); }
  .sa-drawer a.active { color: var(--accent); background: var(--accent-glow); border-color: var(--accent-dim); }
  .sa-drawer a svg,
  .sa-drawer button[data-theme-toggle] svg { width: 20px; height: 20px; flex-shrink: 0; }
  .sa-drawer-group-label {
    margin: 12px 8px 4px; padding-top: 12px; border-top: 1px solid var(--line);
    color: var(--ink-faint); font-family: var(--font-m); font-size: 9px;
    letter-spacing: .16em; text-transform: uppercase;
  }
  .sa-drawer a.sa-drawer-sub {
    min-height: 42px; padding: 9px 12px 9px 44px;
    color: var(--ink-dim); font-size: 13px;
  }
  .sa-drawer-foot {
    margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line);
    display: flex; flex-direction: column; gap: 8px;
  }
}

@media (min-width: 769px), (pointer: fine) and (hover: hover) {
  .sa-nav-menu, .sa-drawer-mask, .sa-drawer { display: none !important; }
}

/* ════════════════════════════════════════════════════════════════
   2. 底部 Tab sa-tabs — 增大、加安全区
══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) and (pointer: coarse), (max-width: 768px) and (hover: none) {
  .sa-tabs {
    height: var(--tab-h);
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-shadow: 0 -8px 30px rgba(0,0,0,.18);
  }
  .sa-tab {
    font-size: 10px; gap: 4px;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .sa-tab svg { width: 22px; height: 22px; }
  .sa-tab span { font-size: 10px; letter-spacing: .04em; }
  /* 工作台用三键 tab 时，字号略大 */
  .sa-tab[data-sp] span { font-size: 11px; }
}

/* ════════════════════════════════════════════════════════════════
   3. 通用弹窗 / Toast / 卡片 — 手机端贴底
══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) and (pointer: coarse), (max-width: 768px) and (hover: none) {
  .sa-modal-overlay { align-items: flex-end; padding: 0; }
  .sa-modal {
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    padding: 22px 18px calc(var(--tab-h) + 24px);
    max-width: 100%; width: 100%; margin: 0;
    transform: translateY(100%);
    max-height: 88vh; overflow-y: auto;
  }
  .sa-modal-overlay.open .sa-modal { transform: translateY(0); }
  .sa-modal-actions { flex-direction: column-reverse; }
  .sa-modal-actions .btn-primary, .sa-modal-actions .btn-ghost { width: 100%; min-height: 46px; justify-content: center; }

  .sa-toast { bottom: calc(var(--tab-h) + 14px); max-width: 90vw; }
  .sa-confirm-wrap, .sa-auth-issue { padding: 14px; align-items: flex-end; }
  .sa-confirm-card, .sa-auth-issue-card {
    width: 100%; border-radius: 20px 20px 0 0; padding: 22px 18px calc(var(--tab-h) + 20px);
    max-height: 88vh; overflow-y: auto;
  }
  .sa-auth-issue-meta { grid-template-columns: 1fr; }
  .sa-auth-issue-actions, .sa-confirm-actions { justify-content: stretch; }
  .sa-auth-issue-actions button, .sa-confirm-actions button { flex: 1; min-height: 44px; }

  /* 卡片网格全部单列 */
  .works-grid, .mcards, .emodes, .wbtns, .expcards, .exp-dl-cards,
  .product-grid, .concept-grid, .bp-chars, .exp-cards,
  .br-char-grid, .act-cards { grid-template-columns: 1fr !important; gap: 12px !important; }
}

/* ════════════════════════════════════════════════════════════════
   4. 小说工作台 studio — 三栏 → 单栏 + 底部三键切换
══════════════════════════════════════════════════════════════════ */
.mobile-studio-guide, .mobile-write-strip, .mobile-tool-sheet-head,
.mobile-tool-label, .mobile-tool-advanced, .mobile-ai-intro,
.mobile-ai-more-toggle, .mobile-ai-project-tools, .mobile-tool-backdrop,
.mobile-selection-hint, .mobile-ai-rewrite-btn { display: none; }
.mobile-ai-more { display: contents; }
.ai-btn small { display: none; }

@media (max-width: 768px) and (pointer: coarse), (max-width: 768px) and (hover: none) {
  body.ws-page {
    --nav-h: 46px;
    --tab-h: calc(58px + env(safe-area-inset-bottom, 0px));
    overflow: hidden !important; height: 100dvh !important;
  }

  /* 手机工作台不是桌面三栏的缩小版：三个面板都是独立的全屏工作区。 */
  .studio {
    display: block;
    height: calc(100dvh - var(--nav-h) - var(--tab-h));
    margin-top: var(--nav-h);
    overflow: hidden;
    position: relative;
    background: var(--bg-soft);
  }
  .left-panel, .center-panel, .right-panel {
    position: absolute; inset: 0;
    width: 100%; height: 100%; min-width: 0;
    border: none !important;
    background: var(--bg-soft);
    overscroll-behavior: contain;
  }
  .left-panel, .right-panel { display: none; }
  .center-panel { display: flex; overflow: hidden; }
  .sp-off { display: none !important; }
  .left-panel.sp-on, .right-panel.sp-on { display: flex !important; z-index: 5; }
  .center-panel.sp-off { display: none !important; }

  /* 非写作页保留一条轻量标题；写作页直接让正文接管屏幕。 */
  .center-head {
    min-height: 46px; padding: 6px 12px; gap: 6px;
    flex-wrap: nowrap; background: var(--bg-mid);
  }
  .center-phase-label {
    min-width: 0; font-size: 10px; letter-spacing: .14em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .studio[data-phase="write"] .center-head { display: none; }
  .center-actions {
    min-width: 0; display: flex; flex: 1; gap: 6px;
    overflow-x: auto; scrollbar-width: none;
  }
  .center-actions::-webkit-scrollbar { display: none; }
  .center-actions .btn-sm, .center-actions .btn-ghost {
    min-height: 34px; padding: 6px 9px !important;
    font-size: 10px !important; white-space: nowrap; flex-shrink: 0;
  }
  .center-head > div:last-child { display: none; }

  /* 写作阶段只保留一个滚动容器，避免正文与 center-body 互相抢滚动。 */
  .studio[data-phase="write"] .center-body {
    display: flex; flex-direction: column; overflow: hidden;
  }
  .write-header-sticky {
    position: relative; top: auto; z-index: 5;
    display: flex; flex-direction: column; flex-shrink: 0;
    box-shadow: 0 5px 16px rgba(0,0,0,.07);
  }
  .chapter-title-bar {
    order: -2; padding: 9px 16px 8px;
    font-size: 16px; line-height: 1.3; letter-spacing: .06em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .mobile-write-strip {
    order: -1; min-height: 48px; padding: 5px 7px;
    display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 4px;
    border-bottom: 1px solid var(--line); background: var(--bg-mid);
  }
  .mobile-write-strip .mobile-write-action {
    min-width: 0; min-height: 38px; padding: 4px 2px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
    border: 1px solid transparent; border-radius: 8px;
    background: transparent; color: var(--ink-dim);
    font-family: var(--font-s); font-size: 10px; white-space: nowrap;
  }
  .mobile-write-action > span { font-family: var(--font-m); font-size: 11px; line-height: 1; }
  .mobile-write-action.primary {
    color: #080706; background: var(--accent); border-color: var(--accent);
    font-weight: 600;
  }
  .mobile-write-action.has-selection {
    color: var(--accent); border-color: var(--accent-dim); background: var(--accent-glow);
  }
  .write-toolbar {
    display: none; overflow: visible;
  }
  .write-toolbar.mobile-open {
    position: fixed; z-index: 242; left: 10px; right: 10px;
    bottom: calc(var(--tab-h) + 10px); max-height: min(430px,72vh);
    display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px;
    padding: 14px; overflow-y: auto; background: var(--bg-mid);
    border: 1px solid var(--line-strong); border-radius: 16px;
    box-shadow: 0 18px 55px rgba(0,0,0,.38);
  }
  .mobile-tool-sheet-head {
    grid-column: 1/-1; display: flex; align-items: center;
    justify-content: space-between; padding: 0 2px 7px;
  }
  .mobile-tool-sheet-head strong { display: block; font-size: 15px; color: var(--ink); }
  .mobile-tool-sheet-head small { display: block; margin-top: 3px; font-size: 11px; color: var(--ink-dim); }
  .mobile-tool-sheet-head button {
    width: 34px; height: 34px; min-height: 34px; border-radius: 50%;
    border: 1px solid var(--line-md); background: transparent; color: var(--ink-dim); font-size: 20px;
  }
  .mobile-selection-hint {
    grid-column: 1/-1; display: block; padding: 8px 9px; border-radius: 8px;
    background: var(--accent-glow); color: var(--ink-dim);
    font-size: 11px; line-height: 1.45;
  }
  .tool-btn {
    min-width: 0; min-height: 44px; padding: 8px 10px;
    display: flex; align-items: center; justify-content: center; gap: 7px;
    font-size: 12px; background: var(--surface);
  }
  .mobile-tool-label { display: inline; }
  .mobile-ai-rewrite-btn { grid-column: 1/-1; color: var(--accent); border-color: var(--accent-dim); }
  .mobile-ai-rewrite-btn:disabled { opacity: .42; }
  .tool-sep { display: none; }
  .write-mode-select {
    display: none;
  }
  .mobile-tool-advanced { grid-column: 1/-1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .mobile-tool-advanced button {
    min-height: 42px; padding: 8px; border-radius: var(--r);
    border: 1px dashed var(--line-md); background: transparent;
    color: var(--ink-dim); font-family: var(--font-s); font-size: 12px;
  }
  .mobile-tool-backdrop {
    position: fixed; inset: 0; z-index: 4; width: 100%; height: 100%;
    border: none; background: rgba(0,0,0,.48); opacity: 0;
    pointer-events: none; transition: opacity .16s ease;
  }
  .mobile-tool-backdrop.open { display: block; opacity: 1; pointer-events: auto; }

  /* 保留原来的纸张/衬线气质，但按手机阅读距离重做字号和留白。 */
  .writing-area {
    flex: 1; min-height: 0; overflow-y: auto;
    padding: 17px max(16px, calc((100vw - 680px) / 2));
    font-size: 16px; line-height: 1.92; letter-spacing: .018em;
    scroll-padding: 18px;
  }
  .writing-area .novel-p { font-size: 16px; line-height: 1.92; margin-bottom: 5px; }
  .writing-area .novel-ch-title { font-size: 18px; margin-bottom: 15px; }
  .writing-area:empty::before { line-height: 1.8; }

  /* AI 草稿操作改成稳定的双列触控区，不让长按钮挤出屏幕。 */
  .ai-draft-sandbox { margin: 14px 0 18px; padding: 14px 12px 12px; }
  .ai-draft-text { font-size: 16px; line-height: 2; }
  .ai-draft-bar { flex-direction: column; align-items: stretch; gap: 10px; }
  .ai-draft-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .draft-btn {
    width: 100%; min-width: 0; min-height: 44px; padding: 8px 10px;
    border-radius: var(--r); display: inline-flex; align-items: center;
    justify-content: center; white-space: normal; text-align: center;
  }
  .draft-check { font-size: 12px; line-height: 1.6; }

  /* “项目”页：阶段在上、章节在前、故事沙盘在后，整页只滚一次。 */
  .left-panel.sp-on { overflow-y: auto; overflow-x: hidden; }
  .project-info {
    order: 1; padding: 11px 14px 10px;
    background: linear-gradient(180deg,var(--bg-mid),var(--bg-soft));
  }
  .project-mode-badge { font-size: 9px; margin-bottom: 3px; }
  .project-title-input { font-size: 16px !important; line-height: 1.35; }
  #aiNameBtn { display: none; }
  .mobile-studio-guide {
    order: 2; display: block; margin: 10px 10px 8px; padding: 15px;
    border: 1px solid var(--accent-dim); border-radius: 14px;
    background: linear-gradient(145deg,var(--accent-glow),color-mix(in srgb,var(--surface) 78%,transparent));
  }
  .mobile-guide-kicker {
    margin-bottom: 6px; font-family: var(--font-m); font-size: 9px;
    letter-spacing: .16em; color: var(--accent); text-transform: uppercase;
  }
  .mobile-studio-guide h2 { font-family: var(--font-s); font-size: 17px; color: var(--ink); line-height: 1.35; }
  .mobile-studio-guide p { margin-top: 6px; color: var(--ink-dim); font-size: 12.5px; line-height: 1.65; }
  .mobile-guide-primary {
    width: 100%; min-height: 44px; margin-top: 13px; border: none;
    border-radius: 10px; background: var(--accent); color: #080706;
    font-family: var(--font-s); font-size: 13px; font-weight: 600;
  }
  .mobile-guide-steps-toggle {
    width: 100%; min-height: 34px; margin-top: 4px; border: none;
    background: transparent; color: var(--ink-dim); font-family: var(--font-s); font-size: 11px;
  }
  .mobile-guide-steps-toggle span { display: inline-block; transition: transform .15s; }
  .mobile-guide-steps-toggle[aria-expanded="true"] span { transform: rotate(180deg); }
  .phase-nav {
    order: 3; display: none; grid-template-columns: repeat(4,minmax(0,1fr));
    overflow: visible; gap: 4px; padding: 8px 10px;
    border-bottom: 1px solid var(--line); background: var(--bg-mid);
  }
  .left-panel.show-mobile-steps .phase-nav { display: grid; }
  .phase-btn {
    min-width: 0; min-height: 46px; padding: 8px 4px;
    flex-direction: column; justify-content: center; gap: 2px;
    border-left: none; border-bottom: 2px solid transparent;
    border-radius: var(--r) var(--r) 0 0; text-align: center; position: relative;
  }
  .phase-btn.active { border-left-color: transparent; border-bottom-color: var(--accent); }
  .phase-icon { display: none; }
  .phase-name { flex: none; font-size: 12px; white-space: nowrap; }
  .phase-check { position: absolute; top: 3px; right: 5px; margin: 0; font-size: 9px; }
  .chapter-list {
    order: 4; flex: none; min-height: 0; overflow: visible;
    padding: 4px 10px 3px;
  }
  .chapter-list::before {
    content: "章节目录"; display: block; padding: 8px 4px 9px;
    font-family: var(--font-m); font-size: 10px; letter-spacing: .18em;
    color: var(--accent); text-transform: uppercase;
  }
  .chapter-item {
    min-height: 46px; margin-bottom: 4px; padding: 9px 11px;
    border: 1px solid transparent; border-radius: var(--r);
    background: color-mix(in srgb,var(--surface) 72%,transparent);
  }
  .chapter-item.active { border-color: var(--accent-dim); }
  .ch-name { font-size: 14px; }
  .ch-words { font-size: 10px; }
  .add-chapter-btn {
    order: 5; width: calc(100% - 20px); min-height: 44px;
    margin: 0 10px 12px; padding: 8px 12px;
    justify-content: center; border: 1px dashed var(--line-md);
    border-radius: var(--r); font-size: 12px;
  }
  .story-state-panel {
    display: none !important;
  }
  #langStylePanel { order: 6; }
  #progressPanel { order: 7; }

  /* AI 页：顶部切换与底部“完成本章”固定，中间内容独立滚动。 */
  .right-panel.sp-on { overflow: hidden; background: var(--bg-soft); }
  .right-head { min-height: 44px; background: var(--bg-mid); }
  .right-head button { min-height: 44px; padding-block: 9px !important; font-size: 12px !important; }
  .right-body { padding: 12px 12px 14px; gap: 11px; }
  .mobile-ai-intro {
    display: grid; gap: 10px; padding: 11px 12px;
    border: 1px solid var(--accent-dim); border-radius: 12px;
    background: var(--accent-glow);
  }
  .mobile-ai-intro strong { font-size: 14px; color: var(--ink); }
  .mobile-ai-intro p { margin-top: 3px; font-size: 11.5px; line-height: 1.55; color: var(--ink-dim); }
  .mobile-ai-intro label {
    display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center;
    font-family: var(--font-m); font-size: 10px; color: var(--ink-dim);
  }
  #mobileStudioModelSelect {
    min-width: 0; min-height: 38px; padding: 6px 8px !important;
    border: 1px solid var(--line-md); border-radius: 8px;
    background: var(--surface); color: var(--ink); font-size: 12px !important;
  }
  .right-section-title { font-size: 10px; }
  .right-section-body { padding: 10px 11px; font-size: 13px; line-height: 1.65; }
  .ai-btns { gap: 7px; }
  .ai-btn { min-height: 48px; padding: 9px 12px; font-size: 13px; letter-spacing: .04em; }
  .ai-btn > span:last-child { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .ai-btn small { display: block; font-family: var(--font-s); font-size: 10.5px; letter-spacing: 0; color: var(--ink-faint); }
  .mobile-ai-more-toggle {
    width: 100%; min-height: 40px; padding: 7px 10px;
    display: flex; align-items: center; justify-content: center; gap: 7px;
    border: 1px solid var(--line); border-radius: 10px;
    background: transparent; color: var(--ink-dim); font-family: var(--font-s); font-size: 12px;
  }
  .mobile-ai-more-toggle span { transition: transform .15s; }
  .mobile-ai-more-toggle.open span { transform: rotate(180deg); }
  .mobile-ai-more { display: none; }
  .mobile-ai-more.open { display: flex; flex-direction: column; gap: 11px; }
  .mobile-ai-settings .right-section-body { font-size: 11px !important; }
  .mobile-ai-project-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
  .mobile-ai-project-tools button {
    min-height: 42px; padding: 8px; border: 1px dashed var(--line-md);
    border-radius: 9px; background: transparent; color: var(--ink-dim);
    font-family: var(--font-s); font-size: 11.5px;
  }
  .complete-btn {
    min-height: 48px; margin: 8px 12px 10px; font-size: 12px;
    border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,.16);
  }

  /* 设定、大纲、导出等非写作阶段保持自然的整页滚动。 */
  .studio:not([data-phase="write"]) .center-body { overflow-y: auto; }
  .bible-tabs { overflow-x: auto; scrollbar-width: none; }
  .bible-tab { flex: 1 0 auto; min-height: 42px; padding: 8px 13px; font-size: 10.5px; }

  /* 手机表单：16px 保住 iOS 不缩放，靠紧凑高度和层级减少“又大又挤”。 */
  .studio input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]),
  .studio textarea, .studio select {
    width: 100%; max-width: 100%; min-width: 0;
    color: var(--ink); font-size: 16px !important; line-height: 1.35;
    text-overflow: ellipsis; box-sizing: border-box;
  }
  .studio input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]),
  .studio select {
    min-height: 40px; padding: 7px 10px !important;
  }
  .studio textarea {
    min-height: 66px; max-height: 170px; padding: 9px 10px !important;
    line-height: 1.6; resize: none !important; overflow-y: auto;
  }
  .studio input::placeholder, .studio textarea::placeholder {
    color: var(--ink-faint); font-size: 13px; font-style: normal; opacity: 1;
  }
  .studio input:focus, .studio textarea:focus, .studio select:focus {
    border-color: var(--accent-dim); box-shadow: 0 0 0 2px var(--accent-glow);
  }
  .studio .project-title-input {
    min-height: 30px; padding: 2px 0 !important; box-shadow: none;
  }
  .bible-form, .bible-review { padding: 9px 10px 16px; gap: 10px; }
  .form-section {
    gap: 8px; padding: 11px; border: 1px solid var(--line);
    border-radius: 12px; background: color-mix(in srgb,var(--surface) 72%,transparent);
  }
  .form-section-title {
    padding-bottom: 7px; font-size: 9px; letter-spacing: .16em;
  }
  .form-row, .br-char-grid { grid-template-columns: 1fr; gap: 8px; }
  .form-field { min-width: 0; gap: 4px; }
  .sa-label {
    margin-bottom: 2px; font-size: 10px; letter-spacing: .1em;
    line-height: 1.45; white-space: normal; overflow-wrap: anywhere;
  }
  .sa-label span { letter-spacing: 0; text-transform: none; }
  .sa-input, .sa-select, .sa-textarea {
    border-radius: 9px; background: var(--bg-soft);
  }
  .bible-form .btn-primary, .bible-form > .btn-primary {
    width: 100%; min-height: 44px; justify-content: center;
    padding: 9px 12px !important; white-space: normal; text-align: center;
  }
  .char-card, .faction-card { padding: 10px; border-radius: 10px; }
  .char-card-head { gap: 7px; margin-bottom: 8px; padding-right: 22px; }
  .char-name-input {
    min-width: 0; min-height: 36px !important; padding: 5px 8px !important;
    border: 1px solid var(--line) !important; border-radius: 8px;
    background: var(--bg-soft) !important; font-size: 15px !important;
  }

  /* 设定预览：减少卡片套卡片，长文字完整换行，编辑框自动增高。 */
  #bibleHealthBox {
    margin: 8px 10px 0 !important; padding: 10px 11px !important;
    overflow-wrap: anywhere;
  }
  .br-v2 { padding: 9px 10px 18px; gap: 9px; }
  .br-v2-section, .br-section { border-radius: 11px; }
  .br-v2-head, .br-section-head {
    min-height: 40px; padding: 8px 10px; gap: 7px;
    flex-wrap: wrap; font-size: 9px; letter-spacing: .14em;
  }
  .br-v2-head > div { min-width: 0; flex-wrap: wrap; }
  .br-v2-head .ai-field-btn {
    width: auto !important; min-width: 0; min-height: 34px !important;
    padding: 5px 8px !important; font-size: 10px !important;
  }
  .br-v2-body, .br-section-body { min-width: 0; padding: 9px 10px; }
  .br-text, .br-char-detail, .right-section-body,
  .sky-syn, .sky-item, .outline-synopsis-input {
    min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
  }
  .br-char-card { min-width: 0; padding: 10px; }
  .br-tag, .rel-tag-item { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .char-edit-card { padding: 9px; margin-bottom: 7px; border-radius: 10px; }
  .char-edit-header { flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
  .char-edit-header .char-role-select { width: auto; flex: 0 1 auto; }
  .char-edit-header .char-name-input { flex: 1 1 140px; }
  .char-edit-header .ai-field-btn { min-height: 34px !important; padding: 5px 8px !important; }
  .char-del-btn { position: static; width: 34px; height: 34px; min-height: 34px; }
  .char-fields { gap: 6px; }
  .char-field-row {
    display: grid; grid-template-columns: 42px minmax(0,1fr) 34px;
    align-items: center; gap: 6px;
  }
  .char-field-label {
    width: auto; min-width: 0; font-size: 9px; letter-spacing: .08em;
    line-height: 1.25; white-space: normal;
  }
  .char-field-input { min-height: 40px !important; padding: 7px 9px !important; }
  .char-field-row .ai-field-btn {
    width: 34px; height: 34px; min-height: 34px; padding: 0;
  }
  .char-field-row .ai-field-btn:empty::before { content: "✦"; font-size: 12px; }
  #relChar1, #relChar2 { width: calc(50% - 3px); flex: 1 1 calc(50% - 3px); }
  #relType { width: 100%; flex: 1 1 100%; }
  #relChar1 ~ .ss-mini-btn, #relChar2 ~ .ss-mini-btn { flex: 1 1 100%; min-height: 38px; }
  #relGraphSvg { min-height: 140px !important; overflow-x: auto; }

  .chat-messages { padding: 12px 10px; gap: 9px; }
  .chat-msg { max-width: 94%; padding: 9px 11px; font-size: 14px; line-height: 1.65; }
  .chat-input-row { padding: 7px 9px; gap: 7px; }
  .chat-input { min-width: 0; min-height: 42px !important; max-height: 110px; }

  /* 大纲也是一种预览：标题单行省空间，概要按内容增高且不截字。 */
  .outline-list { padding: 9px 10px 16px; gap: 7px; }
  .outline-item { min-width: 0; padding: 10px; border-radius: 10px; }
  .outline-item-head { min-width: 0; gap: 6px; margin-bottom: 5px; }
  .outline-num { min-width: 25px; font-size: 9px; }
  .outline-title-input {
    min-width: 0; min-height: 36px !important; padding: 5px 7px !important;
    border: none !important; background: transparent !important; font-size: 15px !important;
  }
  .outline-item-head .btn-danger { width: 34px; min-height: 34px; margin-left: 0 !important; padding: 4px !important; }
  .outline-synopsis-input {
    min-height: 64px; max-height: 145px; padding: 7px 4px !important;
    border: none !important; background: transparent !important; font-size: 14px !important;
    line-height: 1.65;
  }
  .domino-btn { display: none !important; }
  .export-area { padding: 14px; gap: 12px; }
  .export-card { padding: 16px; }

  /* 天窗和划词改稿都用手机熟悉的底部面板形态。 */
  .skylight-overlay { justify-content: flex-end; }
  .skylight-panel {
    width: 100% !important; max-width: 100% !important; margin: auto 0 0 !important;
    max-height: 88vh !important; border-radius: 18px 18px 0 0;
  }
  .skylight-body { padding: 14px 14px 24px; }
  .sky-tabs { padding: 8px 12px 0; overflow-x: auto; }
  .sky-tab { padding: 8px 12px; font-size: 12px; flex-shrink: 0; }
  .revise-pop {
    left: 8px !important; right: 8px !important; top: auto !important;
    bottom: calc(var(--tab-h) + 10px) !important;
    min-width: 0 !important; max-width: none !important;
  }
  .batch-count-presets {
    display: grid; grid-template-columns: repeat(auto-fit,minmax(64px,1fr)); gap: 6px;
    margin-bottom: 12px;
  }
  .batch-count-presets button {
    min-width: 0; min-height: 40px; padding: 6px 3px;
    border: 1px solid var(--line-md); border-radius: 9px;
    background: var(--surface); color: var(--ink-dim);
    font-family: var(--font-s); font-size: 11px; white-space: nowrap;
  }
  .batch-count-presets button.selected {
    color: var(--accent); border-color: var(--accent); background: var(--accent-glow);
  }
  .batch-count-row {
    display: grid; grid-template-columns: auto 64px 1fr; align-items: center; gap: 8px;
  }
  .batch-count-row #batchCount {
    width: 64px !important; min-height: 42px; padding: 6px !important;
    font-size: 16px !important;
  }

  /* 首次进入只出现一次的三步说明，不做长教程。 */
  .mobile-studio-intro {
    position: fixed; inset: 0; z-index: 500;
    display: flex; align-items: flex-end; padding: 12px;
    background: rgba(0,0,0,.58); animation: sa-fadeUp .18s ease-out;
  }
  .mobile-studio-intro.closing { opacity: 0; transition: opacity .18s; }
  .mobile-intro-card {
    width: 100%; padding: 18px 16px calc(16px + env(safe-area-inset-bottom,0px));
    border: 1px solid var(--line-strong); border-radius: 18px;
    background: var(--bg-mid); box-shadow: 0 20px 60px rgba(0,0,0,.42);
  }
  .mobile-intro-kicker {
    font-family: var(--font-m); font-size: 9px; letter-spacing: .16em;
    color: var(--accent); text-transform: uppercase;
  }
  .mobile-intro-card h2 { margin-top: 6px; font-family: var(--font-s); font-size: 19px; color: var(--ink); }
  .mobile-intro-steps { display: grid; gap: 8px; margin: 15px 0; }
  .mobile-intro-steps > div {
    display: flex; align-items: center; gap: 11px; padding: 9px 10px;
    border-radius: 10px; background: var(--surface);
  }
  .mobile-intro-steps b {
    width: 28px; height: 28px; display: grid; place-items: center; flex: 0 0 28px;
    border-radius: 50%; background: var(--accent-glow); color: var(--accent); font-size: 12px;
  }
  .mobile-intro-steps span { display: flex; flex-direction: column; gap: 2px; }
  .mobile-intro-steps strong { font-size: 13px; color: var(--ink); }
  .mobile-intro-steps small { font-size: 11px; color: var(--ink-dim); }
  .mobile-intro-done {
    width: 100%; min-height: 46px; border: none; border-radius: 10px;
    background: var(--accent); color: #080706; font-family: var(--font-s); font-size: 13px; font-weight: 600;
  }
}

/* 首页是访客最常见的落点，保留明确登录入口；创作页仍使用更收拢的导航。 */
@media (max-width: 768px) and (pointer: coarse), (max-width: 768px) and (hover: none) {
  body.home-page .sa-auth-slot { display:flex !important; }
  body.home-page .sa-auth-slot .sa-auth-link,
  body.home-page .sa-auth-slot .sa-register-link { min-height:44px; padding:0 10px; font-size:12px; }
  body.home-page .sa-auth-slot .sa-register-link { display:none; }
}

@media (max-width: 380px) and (pointer: coarse), (max-width: 380px) and (hover: none) {
  .center-head { padding-inline: 9px; }
  .center-actions .btn-sm, .center-actions .btn-ghost { padding-inline: 8px !important; }
  .writing-area { padding: 15px 14px; font-size: 15.5px; }
  .writing-area .novel-p { font-size: 15.5px; }
  .phase-name { font-size: 11px; }
}

/* ════════════════════════════════════════════════════════════════
   5. 短剧 drama-v3 — 三栏 dv-shell → 单栏
══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) and (pointer: coarse), (max-width: 768px) and (hover: none) {
  /* 让 dv-body / dv-center 成为独立的整屏滚动容器（页内分块滚，不再锁死）*/
  .dv-shell, .dv-shell.no-right, .dv-shell.v3w-shell {
    overflow: hidden;
    display: block;
    height: calc(100dvh - var(--nav-h) - var(--tab-h));
    margin-top: var(--nav-h);
    overflow: hidden;
  }
  .dv-center {
    background: var(--bg-soft);
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }
  /* dv-head 固定，dv-body 独立滚动 */
  .dv-head { flex-shrink: 0; }
  .dv-body, .v3w-work { flex: 1; min-height: 0; }
  .dv-body { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  .v3w-work { display:flex; flex-direction:column; overflow:hidden; }
  .v3w-episode-rail { flex:0 0 auto; border-right:0; border-bottom:1px solid var(--line-md); }
  .v3w-episode-rail > header { display:none; }
  .v3w-center { min-height: 0; }
  .v3w-script { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  .v3w-actions { flex-shrink: 0; }

  /* 头部：标签换行，模型收窄，导出变小 */
  .dv-head { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .dv-label { flex: 1 1 100%; font-size: 11px; letter-spacing: .14em; order: -1; }
  .dv-head select { min-width: 0; max-width: 56vw; font-size: 12px; padding: 7px 26px 7px 10px; }
  .dv-head .btn-sm { font-size: 12px; padding: 7px 12px; min-height: 36px; }

  /* 对话区 */
  .dv-msgs { padding: 14px 14px 6px; gap: 12px; }
  .dv-turn { max-width: 92%; }
  .dv-msg { font-size: 15px; padding: 11px 14px; }
  .dv-ava { width: 28px; height: 28px; font-size: 12px; }
  .dv-inrow { padding: 10px 12px calc(var(--tab-h) + 10px); gap: 6px; }
  .dv-input { font-size: 16px; padding: 10px 12px; min-height: 46px; }
  .dv-inrow button { height: 46px; padding: 0 14px; font-size: 13px; }
  .dv-oneshot { padding: 8px 12px; flex-wrap: wrap; }
  .dv-os-label { font-size: 12px; flex: 1 1 100%; }

  /* 作品设定编辑 */
  .v3-wrap { padding: 16px 14px 40px; }
  .v3-fgrid, .v3-grid2 { grid-template-columns: 1fr; }
  .v3-chargrid { grid-template-columns: 1fr; }
  .v3-contract-grid, .v3-statgrid, .v3-arc-summary { grid-template-columns: 1fr 1fr; }

  /* 大纲页 */
  .v3-arc-wrap { max-width: 100%; padding: 0 14px; }
  .v3-arc-board-head, .v3-arc-lanes, .v3-episode-list, .v3-sky-two,
  .v3-series-brief, .v3-arc-strip, .v3-ep-grid, .v3-next-action,
  .v3-ep-command, .v3-act-grid, .v3-episode-card { grid-template-columns: 1fr; }
  .v3-ep-spine { min-height: 0; border-right: none; border-bottom: 1px solid var(--line); padding-bottom: 8px; flex-direction: row; gap: 10px; }
  .v3w-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px 12px; }
  .v3w-actions .v3-idea { grid-column: 1 / -1; }
  .v3w-script { padding: 18px 14px; }
  /* 手机端保留真实集数栏：横滑选择未写、候选和待复检剧集。 */
  .v3w-eplist { display: flex; flex: 0 0 auto; align-items: stretch; gap: 6px; overflow-x: auto; overflow-y: hidden; padding: 7px 10px; border-right: 0; border-bottom: 0; scrollbar-width: none; }
  .v3w-eplist::-webkit-scrollbar { display: none; }
  .v3w-batchbar { flex: 0 0 142px; justify-content: center; padding: 0 9px 0 0; border-right: 1px solid var(--line); border-bottom: 0; }
  .v3w-ep { flex: 0 0 auto; max-width: 150px; margin: 0; border: 1px solid transparent; }
  .v3w-ep.on { border-color: var(--accent-dim); }
  .v3w-actions > #v3wAdopt, .v3w-actions > #v3wGen, .v3w-actions > #v3wNext { grid-column: 1 / -1; }
  .v3w-actions > .v3-idea, .v3w-actions > .v3w-improve, .v3w-actions > #v3wStatus { grid-column: 1 / -1; }
  .v3w-improve { flex-direction: column; align-items: stretch; }
  .v3w-more, .v3w-more summary { width: 100%; box-sizing: border-box; }

  /* 弹层 */
  .dv-overlay { padding: 0; align-items: flex-end; }
  .dv-ov-card { width: 100%; max-width: 100%; border-radius: 16px 16px 0 0; max-height: 88vh; }
  .dv-ov-body { grid-template-columns: 1fr; overflow-y: auto; }
  .dv-ol-right { border-left: none; border-top: 1px solid var(--line-md); }
}

/* ════════════════════════════════════════════════════════════════
   6. 长剧 ld — 四页适配
══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) and (pointer: coarse), (max-width: 768px) and (hover: none) {
  body.ld-on { overflow: hidden !important; height: 100dvh !important; }
  .ld-shell { height: calc(100dvh - var(--nav-h) - var(--tab-h)); margin-top: var(--nav-h); overflow: hidden; }

  /* 顶部 */
  .ld-top { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .ld-proj { flex: 1 1 60%; min-width: 0; font-size: 11px; }
  .ld-proj b { font-size: 13px; }
  .ld-model { min-width: 0; max-width: 56vw; font-size: 12px; padding: 7px 26px 7px 10px; }
  .ld-ready { font-size: 11px; padding: 5px 10px; }
  .ld-ready .bar { width: 60px; }
  .ld-steps { display: flex; overflow-x: auto; gap: 2px; width: 100%; order: 99; -webkit-overflow-scrolling: touch; padding-top: 4px; }
  .ld-steps::-webkit-scrollbar { display: none; }
  .ld-step { padding: 8px 12px; flex-shrink: 0; font-size: 12px; border-left: none; border-bottom: 2px solid transparent; }
  .ld-step.on { border-left-color: transparent; border-bottom-color: var(--accent); }

  /* 第一页双舱 → 单栏上下 */
  .ld-dual { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .ld-cabin-l { border-right: none; border-bottom: 1px solid var(--line-md); }
  .ld-chatlog { padding: 12px; }
  .ld-bub { font-size: 15px; padding: 10px 13px; }
  .ld-inrow { padding: 10px 12px calc(var(--tab-h) + 10px); }
  .ld-input { font-size: 16px; }
  .ld-chat-actions { padding: 8px 10px; }
  .ld-form { padding: 12px; gap: 10px; }
  .ld-field { padding: 11px 12px; }

  /* 第三页剧本 */
  .ld-smain { grid-template-columns: 1fr; }
  .ld-sleft { display: none; }   /* 集列表收抽屉 */
  .ld-toolbar { padding: 8px 12px; overflow-x: auto; flex-wrap: nowrap; }
  .ld-toolbar::-webkit-scrollbar { display: none; }
  .ld-paper, .ld-editor { padding: 18px 16px; max-width: 100%; margin-bottom: calc(var(--tab-h) + 20px); }
  .ld-dia { max-width: 80%; font-size: 16px; }
  .ld-action { font-size: 15px; }
  .ld-cname { font-size: 14px; }

  /* 第四页导出 */
  .ld-expmain { padding: 18px 14px; overflow-y: auto; }
  .ld-expgrid { grid-template-columns: 1fr; }
  .ld-expcard { padding: 18px 16px; }

  /* 弹窗贴底 */
  .ld-mask, .ld-prev-mask { padding: 0; align-items: flex-end; }
  .ld-dialog, .ld-pitch, .ld-prev { border-radius: 16px 16px 0 0; max-width: 100%; width: 100%; max-height: 88vh; }
  .ld-prev { padding: 20px 18px; }
  .ld-toast { bottom: calc(var(--tab-h) + 14px); }
  .ld-float { bottom: calc(var(--tab-h) + 14px); }
}

/* ════════════════════════════════════════════════════════════════
   7. 电影 film — 四页适配
══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) and (pointer: coarse), (max-width: 768px) and (hover: none) {
  body.fm-on { overflow: hidden !important; height: 100dvh !important; }
  .fm-shell { height: calc(100dvh - var(--nav-h) - var(--tab-h)); margin-top: var(--nav-h); overflow: hidden; }

  .fm-top { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .fm-proj { flex: 1 1 50%; min-width: 0; font-size: 11px; }
  .fm-model { min-width: 0; max-width: 56vw; font-size: 12px; padding: 7px 26px 7px 10px; }
  .fm-steps { display: flex; overflow-x: auto; width: 100%; order: 99; -webkit-overflow-scrolling: touch; }
  .fm-steps::-webkit-scrollbar { display: none; }
  .fm-step { padding: 8px 12px; flex-shrink: 0; border-left: none; border-bottom: 2px solid transparent; }
  .fm-step.on { border-left-color: transparent; border-bottom-color: var(--accent); }

  /* 第一页左右 → 单栏 */
  .fm-one { grid-template-columns: 1fr; }
  .fm-left { border-right: none; }
  .fm-mode-bar { padding: 8px 12px; overflow-x: auto; flex-wrap: nowrap; }
  .fm-mode-bar::-webkit-scrollbar { display: none; }
  .fm-chatlog { padding: 14px; }
  .fm-msg { max-width: 92%; }
  .fm-bub { font-size: 15px; }

  /* 第二页节拍 */
  .fm-two { grid-template-columns: 1fr; }
  .fm-tree { display: none; }   /* 节拍树收抽屉/弹层 */
  .fm-river-bar, .fm-toolbar { padding: 8px 12px; overflow-x: auto; flex-wrap: nowrap; }
  .fm-river-bar::-webkit-scrollbar, .fm-toolbar::-webkit-scrollbar { display: none; }
  .fm-script { padding: 18px 14px; margin-bottom: calc(var(--tab-h) + 20px); }
  .fm-dlg { font-size: 15px; max-width: 100%; }

  /* 第三页 */
  .fm-three { grid-template-columns: 1fr; }
  .fm-scenes { display: none; }  /* 场次列表收抽屉 */

  /* 第四页导出 */
  .fm-four { grid-template-columns: 1fr; }
  .fm-preview { padding: 20px 16px; }

  /* 弹窗贴底 */
  .fm-mask, .fm-prev-mask { padding: 0; align-items: flex-end; }
  .fm-dialog, .fm-prev { border-radius: 16px 16px 0 0; max-width: 100%; width: 100%; max-height: 88vh; }
  .fm-toast { bottom: calc(var(--tab-h) + 14px); }
}

/* ════════════════════════════════════════════════════════════════
   8. 互动影游 igame — 四页适配
══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) and (pointer: coarse), (max-width: 768px) and (hover: none) {
  body.ig-on { overflow: hidden !important; height: 100dvh !important; }
  .ig-shell { height: calc(100dvh - var(--nav-h) - var(--tab-h)); margin-top: var(--nav-h); }

  .ig-top { height: 46px; padding: 0 12px; gap: 8px; flex-wrap: nowrap; overflow: hidden; }
  .ig-brand { font-size: 12px; }
  .ig-brand b { font-size: 13px; }
  .ig-model { font-size: 11px; padding: 5px 8px; max-width: 40vw; }
  .ig-steps-nav { gap: 2px; }
  .ig-stepnav { font-size: 11px; padding: 5px 9px; }

  /* 第一页对话 */
  .ig-chatwrap { max-width: 100%; }
  .ig-chatlog { padding: 14px 14px 8px; }
  .ig-msg { max-width: 92%; }
  .ig-bub { font-size: 15px; padding: 10px 13px; }
  .ig-inrow { padding: 10px 12px calc(var(--tab-h) + 10px); }
  .ig-input { font-size: 16px; }
  .ig-oneshot { padding: 8px 12px; flex-wrap: wrap; }
  .ig-oneshot input { font-size: 14px; padding: 8px 10px; }
  .ig-float-next { right: 14px; bottom: calc(var(--tab-h) + 14px); }

  /* 第二页画布：角色栏/属性栏收起，画布全宽可平移缩放 */
  .ig-cast, .ig-rpanel { position: fixed; top: var(--nav-h); bottom: var(--tab-h); z-index: 60; width: 78vw; max-width: 300px; box-shadow: -10px 0 30px rgba(0,0,0,.3); }
  .ig-cast { left: -78vw; transition: left .25s var(--ease); border-right: 1px solid var(--line-md); }
  .ig-cast.open { left: 0; }
  .ig-rpanel { right: -78vw; transition: right .25s var(--ease); border-left: 1px solid var(--line-md); }
  .ig-rpanel.open { right: 0; }
  .ig-canvas-wrap { width: 100%; }
  .ig-toolbar { top: 8px; right: 8px; }
  .ig-toolbar .ig-btn { min-height: 36px; padding: 6px 10px; font-size: 12px; }

  /* 第三页剧本 */
  .ig-scriptmain { flex-direction: column; }
  .ig-eplist { display: none; }   /* 集列表收抽屉 */
  .ig-stage { padding: 22px 14px calc(var(--tab-h) + 30px); }
  .ig-script { max-width: 100%; }
  .ig-scriptedit { max-width: 100%; padding: 16px; }

  /* 第四页导出 */
  .ig-exportmain { padding: 14px; overflow-y: auto; }
  .ig-flowwrap { padding: 12px; overflow: auto; }
  .ig-exportcard { padding: 16px; }
  .ig-preview { padding: 18px 14px; }

  /* 浮动 AI / 修复弹卡：避开底栏 */
  .ig-floatai, .ig-fix { right: 12px; bottom: calc(var(--tab-h) + 14px); width: calc(100vw - 24px); max-width: 360px; }
  .ig-bubble.cabin { width: calc(100vw - 24px); }
  .ig-toast { bottom: calc(var(--tab-h) + 14px); }
}

/* ════════════════════════════════════════════════════════════════
   9. 视频带货 ads — 四页适配
══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  body.ad-on {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    height: auto !important;
    min-height: 100dvh !important;
  }
  .ad-shell {
    height: auto;
    min-height: calc(100dvh - var(--nav-h));
    overflow: visible;
    padding-bottom: var(--tab-h);
  }

  .ad-top { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .ad-proj { flex: 1 1 50%; min-width: 0; font-size: 11px; }
  .ad-model { min-width: 0; max-width: 56vw; font-size: 12px; padding: 7px 26px 7px 10px; }
  .ad-steps { display: flex; overflow-x: auto; width: 100%; order: 99; -webkit-overflow-scrolling: touch; }
  .ad-steps::-webkit-scrollbar { display: none; }
  .ad-step { padding: 8px 12px; flex-shrink: 0; }

  /* 第一页三栏 → 单栏 */
  .ad-one { grid-template-columns: 1fr; overflow-y: auto; padding: 12px; gap: 12px; }
  .ad-rail { display: none !important; }
  /* 新版信息收集页必须保留资产包和推进按钮；隐藏会让 3/4 补充流程彻底卡死。 */
  .ad-planner .ad-dossier { display: flex !important; min-height: 0 !important; overflow: visible; border-radius: 0; }
  .ad-planner { display: grid; grid-template-columns: minmax(0,1fr); overflow: visible; }
  .ad-planner .ad-left { min-height: 520px; }
  .ad-planner .ad-chatlog { padding: 14px 12px; }
  .ad-planner .ad-msg .ad-bub { max-width: 88%; }
  .ad-planner .ad-board { max-height: none; overflow: visible; padding-bottom: 8px; }
  .ad-planner .ad-progress { position: sticky; bottom: var(--tab-h); z-index: 20; background: var(--surface); box-shadow: 0 -10px 28px rgba(28,36,52,.10); }
  .ad-planner .ad-dims { align-items: stretch; flex-direction: column; }
  .ad-planner #adConfirm { width: 100%; min-height: 48px; }
  .ad-service-notice { position: sticky; top: 52px; z-index: 25; }
  .ad-quickbar { padding: 10px 12px; }
  .ad-quickbar input { padding: 10px 12px; font-size: 14px; }

  /* 第二页 */
  .ad-two { grid-template-columns: 1fr; }
  .ad-three { grid-template-columns: 1fr; }

  /* 第三页写作 */
  .ad-dwrap { grid-template-columns: 1fr; }
  .ad-ep-nav { max-height: 120px; flex-direction: row; overflow-x: auto; padding: 10px; }
  .ad-ep-nav .nav-h { display: none; }
  .ad-script { padding: 18px 14px; margin-bottom: calc(var(--tab-h) + 20px); }

  /* 第四页导出 */
  .ad-four { grid-template-columns: 1fr; }
  .ad-preview { padding: 20px 16px; }

  /* 弹窗贴底 */
  .ad-mask { padding: 0; align-items: flex-end; }
  .ad-dialog { border-radius: 16px 16px 0 0; max-width: 100%; width: 100%; max-height: 88vh; padding: 20px 16px calc(var(--tab-h) + 16px); }
  .ad-toast { bottom: calc(var(--tab-h) + 14px); }
  .ad-limit-tip { right: 12px; bottom: calc(var(--tab-h) + 12px); max-width: calc(100vw - 24px); }
  .ad-bubble input { width: calc(100vw - 60px); }
}

/* ════════════════════════════════════════════════════════════════
   10. 首页 index — HERO 改单栏堆叠
══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) and (pointer: coarse), (max-width: 768px) and (hover: none) {
  .hero {
    min-height: calc(100dvh - var(--nav-h));
    padding: calc(var(--nav-h) + 24px) 18px 32px;
    align-items: flex-start;
  }
  .hero-split { grid-template-columns: 1fr; gap: 28px; }
  .hero-title { font-size: clamp(40px, 12vw, 60px); }
  .hero-eyebrow { font-size: 11px; margin-bottom: 16px; }
  /* 产品预览窗在手机上缩小或下移 */
  .hero-preview, .hero-product, .hero-window { max-width: 100%; }
  /* 选色器靠右下，避开底栏 */
  .home-accent-picker, [class*="accent-picker"] {
    bottom: calc(var(--tab-h) + 14px) !important;
    right: 14px !important;
  }
}

/* ════════════════════════════════════════════════════════════════
   11. 作品库 / 预测 / 拆解 / 账号 / 登录注册 / 后台
══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) and (pointer: coarse), (max-width: 768px) and (hover: none) {
  /* 作品库 */
  .works-page { padding: calc(var(--nav-h) + 20px) 14px calc(var(--tab-h) + 24px); }
  .works-header { margin-bottom: 20px; gap: 10px; }
  .works-title { font-size: 22px; min-width: 0; }
  .works-toolbar { gap: 8px; margin-bottom: 18px; }
  .works-search-wrap { min-width: 0; flex: 1 1 100%; }
  .works-filter-wrap { min-width: 0; flex: 1 1 100%; }
  .works-grid { grid-template-columns: 1fr; gap: 12px; }

  /* 登录 / 注册 / 重置密码 */
  .auth-card, .login-card, .register-card,
  .sa-auth-issue-card, [class*="auth-wrap"] {
    width: 100% !important; max-width: 100% !important;
    margin: 0 !important; border-radius: 0 !important;
    min-height: calc(100dvh - var(--nav-h));
    padding: 28px 20px calc(var(--tab-h) + 28px) !important;
  }
  .auth-page, .login-page, .register-page { padding: 0 !important; }

  /* 账号 */
  .account-page, .me-page { padding: calc(var(--nav-h) + 20px) 14px calc(var(--tab-h) + 24px); }
  .account-grid, .me-grid { grid-template-columns: 1fr; gap: 14px; }

  /* 预测 / 拆解 */
  .predict-page, .analyze-page { padding: calc(var(--nav-h) + 20px) 14px calc(var(--tab-h) + 24px); }
  .predict-grid, .analyze-grid, .concept-grid { grid-template-columns: 1fr; }

  /* 后台 admin */
  .admin-page, .admin-shell { padding: calc(var(--nav-h) + 16px) 12px calc(var(--tab-h) + 20px); }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .admin-table-wrap table { min-width: 640px; }
}

/* ════════════════════════════════════════════════════════════════
   12. 极小屏 ≤ 400px 微调
══════════════════════════════════════════════════════════════════ */
@media (max-width: 400px) and (pointer: coarse), (max-width: 400px) and (hover: none) {
  .dv-msg, .ld-bub, .fm-bub, .ig-bub, .cbub, .sbub { font-size: 14px; }
  .hero-title { font-size: 38px; }
  .center-phase-label, .dv-label { font-size: 10px; }
  .sa-tab span { font-size: 9px; }
}

/* ════════════════════════════════════════════════════════════════
   13. 工具类：手机端显隐
══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) and (pointer: coarse), (max-width: 768px) and (hover: none) {
  .hide-mobile { display: none !important; }
}

/* 首页移动端只保留“理解产品 → 进入创作”这条主线。 */
.hero-mobile-flow,
.hero-mobile-start,
.hero-mobile-login { display: none; }
@media (max-width: 768px) and (pointer: coarse), (max-width: 768px) and (hover: none) {
  body.home-page:not(.home-authed) .workspace {
    display: block;
    min-height: auto;
    padding: 0;
  }
  body.home-page:not(.home-authed) .sa-tabs,
  body.home-page:not(.home-authed) .toolkit-head,
  body.home-page:not(.home-authed) .tool-cards,
  body.home-page:not(.home-authed) #recentHead,
  body.home-page:not(.home-authed) #recentGrid { display: none !important; }
  body.home-page .hero {
    min-height: 100svh;
    padding: calc(74px + env(safe-area-inset-top,0px)) 20px calc(42px + env(safe-area-inset-bottom,0px));
    align-items: center;
  }
  body.home-page .hero-split { display: block; }
  body.home-page .hero-left { max-width: 520px; margin: 0 auto; }
  body.home-page .hero-right,
  body.home-page .hero-stats,
  body.home-page .hero-mode-strip,
  body.home-page .hero-en,
  body.home-page .hero-scroll { display: none !important; }
  body.home-page .hero-eyebrow { margin-bottom: 13px; font-size: 10px; letter-spacing: .14em; }
  body.home-page .hero-title { max-width: 330px; margin-bottom: 18px; font-size: clamp(42px, 12.5vw, 56px); line-height: 1.1; }
  body.home-page .hero-sub { margin-bottom: 25px; font-size: 15px; line-height: 1.75; }
  body.home-page .hero-sub br { display: none; }
  body.home-page .hero-cta { display: grid; grid-template-columns: 1fr; gap: 10px; }
  body.home-page .hero-mobile-start,
  body.home-page .hero-mobile-login { display: inline-flex; }
  body.home-page .hero-desktop-login,
  body.home-page .hero-desktop-register { display: none; }
  body.home-page .btn-hero { width: 100%; min-height: 52px; padding: 13px 18px; justify-content: center; border-radius: 13px; font-size: 14px; }
  body.home-page .hero-mobile-flow { display: flex; align-items: center; justify-content: space-between; gap: 7px; margin-top: 22px; color: var(--ink-faint); font-size: 10px; }
  body.home-page .hero-mobile-flow span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
  body.home-page .hero-mobile-flow b { color: var(--accent); font-family: var(--font-m); font-size: 9px; }
  body.home-page .hero-mobile-flow i { height: 1px; flex: 1; background: var(--line-strong); }
  body.home-page .lobby { padding-top: 26px; }
  body.home-page .section-head { margin-bottom: 16px; }
  body.home-page:not(.home-authed) .lobby {
    padding-bottom: calc(28px + env(safe-area-inset-bottom,0px));
  }
  body.home-page .lobby-bg video,
  body.home-page .lobby-video-canvas { display: none !important; }
}

/* 移动端最终视觉基线：正文易读、控件可点、页面不被底部导航遮住。 */
@media (max-width: 768px) and (pointer: coarse), (max-width: 768px) and (hover: none) {
  body.ws-page, body.dv-on, body.ld-on, body.fm-on, body.ig-on, body.ad-on {
    font-size: 16px;
    line-height: 1.65;
    -webkit-text-size-adjust: 100%;
  }
  .dv-phase-btn, .ld-step, .fm-step, .ig-stepnav, .ad-step {
    font-size: 12px;
    line-height: 1.35;
  }
  .dv-msg, .ld-bub, .fm-bub, .ig-bub, .ad-bub {
    font-size: 15px;
    line-height: 1.7;
  }
  .dv-inrow, .ld-inrow, .fm-inrow, .ig-inrow {
    padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 8px);
  }
  .dv-body, .ld-expmain, .fm-view, .ig-stage, .ad-main {
    padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 16px);
  }
  .dv-btn, .ld-btn, .fm-btn, .ig-btn, .ad-btn,
  .dv-phase-btn, .ld-step, .fm-step, .ig-stepnav, .ad-step {
    touch-action: manipulation;
  }
  .dv-btn, .ld-btn, .fm-btn, .ig-btn, .ad-btn {
    min-height: 44px;
  }
  .dv-mobile-flow small { font-size: 12px; }
}

/* 全站统一的移动端 Dock：创作是主入口，所有创作模式共享同一套底部体验。 */
@media (max-width: 768px) and (pointer: coarse), (max-width: 768px) and (hover: none) {
  :root {
    --dock-h: calc(68px + env(safe-area-inset-bottom, 0px));
    --tab-h: calc(84px + env(safe-area-inset-bottom, 0px));
    --nav-h: calc(50px + env(safe-area-inset-top, 0px));
  }
  .sa-nav,
  .sa-nav.is-scrolled {
    height: var(--nav-h);
    padding: env(safe-area-inset-top, 0px) 14px 0;
  }
  .sa-drawer { padding-top: calc(16px + env(safe-area-inset-top, 0px)); }
  .sa-tabs {
    left: 10px; right: 10px; bottom: 8px;
    height: var(--dock-h); padding: 5px 6px calc(5px + env(safe-area-inset-bottom, 0px));
    border: 1px solid var(--line-strong); border-radius: 20px;
    background: color-mix(in srgb, var(--bg-mid) 94%, transparent) !important;
    box-shadow: 0 12px 32px rgba(0,0,0,.3), 0 2px 8px rgba(0,0,0,.18);
    overflow: visible; z-index: 500;
  }
  .sa-tab {
    min-width: 0; min-height: 50px; gap: 2px; padding: 4px 2px;
    border-radius: 14px; color: var(--ink-faint);
    font-family: var(--font-s); font-size: 10px; letter-spacing: .02em;
    text-transform: none; transform: none !important;
  }
  .sa-tab svg { width: 20px; height: 20px; transition: transform .18s var(--ease); }
  .sa-tab span { font-size: 10px; line-height: 1.15; letter-spacing: 0; }
  .sa-tab-account .sa-tab-auth {
    position:absolute; top:5px; left:50%; transform:translateX(-50%);
    width:21px; height:21px; display:grid; place-items:center;
    border-radius:7px; color:#fff; font-size:9px; font-weight:800;
    box-shadow:0 0 0 2px var(--bg-mid);
  }
  .sa-tab-account.is-authenticated > svg { opacity:0; }
  .sa-tab.active { color: var(--accent); background: var(--accent-glow); }
  .sa-tab.active::before { display: none; }
  .sa-tab.active svg { transform: translateY(-1px); }
  .fm-float, .ld-float, .ig-float-next { bottom: calc(var(--tab-h) + 22px); }

  /* 短剧四步流程始终完整可见，避免横向滚动隐藏“下一步”。 */
  .dv-phase {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: visible; gap: 4px; padding: 5px 10px;
  }
  .dv-phase-btn {
    min-width: 0; min-height: 42px; padding: 5px 2px;
    font-size: 0; white-space: normal; justify-content: center; text-align: center;
  }
  .dv-phase-btn::after { font-size: 11px; line-height: 1; }
  .dv-phase-btn:nth-child(1)::after { content: '想法与设定'; }
  .dv-phase-btn:nth-child(2)::after { content: '安排每集'; }
  .dv-phase-btn:nth-child(3)::after { content: '写剧本'; }
  .dv-phase-btn:nth-child(4)::after { content: '检查导出'; }
}

/* 小说工作台：手机端收紧信息密度，减少“框中套框”的厚重感。
   仅作用于触屏窄屏，桌面端布局完全不受影响。 */
@media (max-width: 768px) and (pointer: coarse), (max-width: 768px) and (hover: none) {
  .ws-page .mobile-studio-guide {
    margin: 6px 10px 5px;
    padding: 11px 12px;
    border-radius: 10px;
  }
  .ws-page .mobile-studio-guide h2 { font-size: 15px; }
  .ws-page .mobile-studio-guide p { margin-top: 4px; font-size: 11.5px; line-height: 1.5; }
  .ws-page .mobile-guide-primary { min-height: 38px; margin-top: 9px; font-size: 12px; }
  .ws-page .mobile-guide-steps-toggle { min-height: 28px; }

  .ws-page .phase-nav { padding: 5px 10px; }
  .ws-page .phase-btn { min-height: 38px; padding: 6px 3px; }
  .ws-page .phase-name { font-size: 11px; }

  .ws-page .chapter-list { padding: 2px 10px 1px; }
  .ws-page .chapter-list::before { padding: 5px 4px 6px; }
  .ws-page .chapter-item {
    min-height: 38px;
    margin-bottom: 3px;
    padding: 7px 9px;
    border-radius: 8px;
    background: color-mix(in srgb,var(--surface) 48%,transparent);
  }
  .ws-page .ch-name { font-size: 13px; }
  .ws-page .add-chapter-btn { min-height: 36px; margin-bottom: 7px; padding: 6px 10px; }

  .ws-page .right-body { padding: 8px 10px 10px; gap: 8px; }
  .ws-page .mobile-ai-intro { gap: 7px; padding: 9px 10px; border-radius: 9px; }
  .ws-page .mobile-ai-intro strong { font-size: 13px; }
  .ws-page .ai-btn { min-height: 42px; padding: 7px 10px; border-radius: 8px; }
  .ws-page .mobile-ai-more-toggle { min-height: 34px; border-radius: 8px; }
  .ws-page .complete-btn { min-height: 42px; margin: 5px 10px 7px; border-radius: 8px; }

  .ws-page .bible-form, .ws-page .bible-review { padding: 7px 10px 12px; gap: 7px; }
  .ws-page .form-section { gap: 6px; padding: 9px; border-radius: 9px; }
  .ws-page .form-section-title { padding-bottom: 5px; }
  .ws-page .br-v2 { padding: 7px 10px 13px; gap: 7px; }
  .ws-page .br-v2-section, .ws-page .br-section { border-radius: 9px; }
  .ws-page .br-v2-head, .ws-page .br-section-head { min-height: 36px; padding: 6px 9px; }
  .ws-page .br-v2-body, .ws-page .br-section-body { padding: 7px 9px; }
}

/* 短剧移动端流程提示只在手机显示。 */
.dv-mobile-flow { display: none; }

/* 其他五种创作页：统一移动端骨架。
   视觉上压缩卡片与工具栏，交互控件仍保留足够的触控面积。 */
@media (max-width: 768px) and (pointer: coarse), (max-width: 768px) and (hover: none) {
  body.dv-on, body.ld-on, body.fm-on, body.ig-on, body.ad-on {
    width: 100%; max-width: 100%; overflow-x: hidden;
  }
  .dv-shell, .ld-shell, .fm-shell, .ig-shell, .ad-shell {
    width: 100%; max-width: 100%; min-width: 0;
  }
  .dv-shell > *, .ld-shell > *, .fm-shell > *, .ig-shell > *, .ad-shell > * { min-width: 0; }

  /* 短剧：顶部阶段导航改为横向滚动，内容区单列，输入区贴近底部。 */
  .dv-top, .dv-head { min-height: 46px; padding: 7px 10px; gap: 6px; }
  /* 短剧的步骤导航就在左栏里，不能为了单列把整个左栏隐藏；
     只保留项目标题、流程导航和手机流程提示。 */
  .dv-left {
    display: block !important;
    width: 100%; height: auto; min-height: 0;
    border: 0; background: var(--bg-mid);
  }
  .dv-leftscroll { display: none !important; }
  .dv-proj { padding: 8px 10px 4px; }
  .dv-center { width: 100%; min-width: 0; }
  .dv-phase { display: flex; overflow-x: auto; padding: 5px 8px; gap: 4px; scrollbar-width: none; }
  .dv-phase::-webkit-scrollbar { display: none; }
  .dv-phase-btn { flex: 0 0 auto; min-height: 40px; padding: 8px 11px; white-space: nowrap; }
  .dv-phase-btn { position: relative; border-radius: 8px; color: var(--ink-faint); }
  .dv-phase-btn.on { color: var(--accent); background: var(--accent-glow); }
  .dv-phase-btn:not(.on) { opacity: .7; }
  .dv-mobile-flow {
    display: grid;
    gap: 3px;
    margin: 8px 10px 2px;
    padding: 10px 11px;
    border-left: 3px solid var(--accent);
    background: color-mix(in srgb,var(--accent-glow) 62%,transparent);
    border-radius: 0 9px 9px 0;
  }
  .dv-flow-kicker {
    color: var(--accent); font-family: var(--font-m); font-size: 9px;
    letter-spacing: .12em; text-transform: uppercase;
  }
  .dv-mobile-flow strong { color: var(--ink); font-size: 13px; line-height: 1.4; }
  .dv-mobile-flow small { color: var(--ink-dim); font-size: 11px; line-height: 1.5; }
  .dv-mobile-next { width: 100% !important; min-height: 46px; box-sizing: border-box; margin-top: 10px; }
  .dv-modelwrap { min-width: 0; flex: 1; }
  .dv-modelwrap select { max-width: 100%; }
  .dv-body { min-width: 0; padding: 9px 10px calc(var(--tab-h) + 14px); }
  .dv-chat, .v3w-script, .v3w-editor, .dv-wrap { min-width: 0; width: 100%; }
  .dv-msgs, .v3w-chatlog { padding: 10px 2px; gap: 8px; }
  .dv-bub, .dv-msg, .v3w-bub { max-width: 94%; }
  .dv-inrow { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 6px; padding: 7px 0; }
  .dv-inrow textarea { grid-column: 1 / -1; min-height: 44px; }
  .dv-inrow button { min-height: 44px; }

  /* 长剧：四步导航收成单行，聊天与表单不再并排挤压。 */
  .ld-top { min-height: 46px; padding: 7px 10px; gap: 6px; }
  .ld-proj, .ld-ready, .ld-model { display: none; }
  .ld-steps { flex: 1; overflow-x: auto; scrollbar-width: none; }
  .ld-steps::-webkit-scrollbar { display: none; }
  .ld-step { flex: 0 0 auto; min-height: 40px; padding: 8px 10px; white-space: nowrap; }
  .ld-dual, .ld-one, .ld-two, .ld-three, .ld-four { display: block !important; min-width: 0; }
  .ld-tcol, .ld-sleft, .ld-form, .ld-chatlog, .ld-paper, .ld-editor { min-width: 0; padding: 10px; }
  .ld-chatlog { gap: 8px; }
  .ld-msg, .ld-bub { max-width: 94%; }
  .ld-inrow { padding: 7px 10px; }
  .ld-input { min-height: 44px; }
  .ld-form { gap: 8px; }
  .ld-field, .ld-expcard, .ld-pitch { padding: 10px; border-radius: 9px; }

  /* 电影与带货：表单/笔记区单列，避免固定列宽导致横向滚动。 */
  .fm-mode-bar { padding: 6px 10px; overflow-x: auto; }
  .fm-seg { flex: 0 0 auto; }
  .fm-seg button { min-height: 40px; padding: 8px 10px; white-space: nowrap; }
  .fm-one, .fm-two, .fm-three, .fm-four { display: block !important; min-width: 0; }
  .fm-left, .fm-note { width: 100%; min-width: 0; border: 0; }
  .fm-note { margin-top: 8px; max-height: 42vh; }
  .fm-panel-head { min-height: 42px; padding: 10px 12px; }
  .fm-chatlog, .fm-form, .fm-grammar, .fm-note-scroll { padding: 10px; }
  .fm-inrow { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 6px; padding: 7px 10px; }
  .fm-inrow textarea { min-height: 44px; grid-column: 1 / -1; }
  .fm-btn { min-height: 44px; }
  .ad-kong, .ad-script, .ad-dwrap, .ad-main, .ad-content { min-width: 0; width: 100%; }
  .ad-top { min-height: 46px; padding: 7px 10px; }
  .ad-step { min-height: 40px; padding: 8px 10px; white-space: nowrap; }
  .ad-kong, .ad-script { padding: 10px !important; }
  .ad-card, .ad-panel, .ad-section, .ad-exportcard { padding: 10px; border-radius: 9px; }
  .ad-ep-nav { max-height: 120px; padding: 6px 8px; }
  .ad-ep-nav button, .ad-btn { min-height: 44px; }

  /* 互动影游：移动端优先保留对话/剧本，画布与角色栏改为可切换的单栏区域。 */
  .ig-top { min-height: 46px; padding: 7px 10px; gap: 6px; }
  .ig-brand { min-width: 0; font-size: 12px; }
  .ig-model { width: 92px; min-height: 40px; }
  .ig-steps-nav { min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .ig-steps-nav::-webkit-scrollbar { display: none; }
  .ig-stepnav { flex: 0 0 auto; min-height: 40px; padding: 8px 10px; white-space: nowrap; }
  .ig-oneshot, .ig-synopsis { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 8px 10px; }
  .ig-oneshot input, .ig-synopsis textarea { min-height: 44px; }
  .ig-oneshot button, .ig-inrow button { min-height: 44px; }
  .ig-progress { overflow-x: auto; padding: 7px 10px; }
  .ig-main, .ig-scriptmain { display: block; min-width: 0; }
  .ig-cast, .ig-rpanel, .ig-eplist { width: 100%; max-height: 120px; border: 0; overflow-y: auto; }
  .ig-cast.collapsed, .ig-rpanel.collapsed { display: none; }
  .ig-canvas-wrap { min-height: 52vh; }
  .ig-stage { padding: 14px 10px calc(var(--tab-h) + 16px); }
  .ig-script, .ig-scriptedit { width: 100%; min-width: 0; }
  .ig-chatlog { padding: 10px; gap: 8px; }
  .ig-inrow { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 6px; padding: 7px 10px; }
  .ig-inrow textarea { grid-column: 1 / -1; min-height: 44px; }
  .ig-float-next { right: 10px; bottom: calc(var(--tab-h) + 10px); }
  .ig-bigbtn { max-width: calc(100vw - 20px); }

  /* 所有移动端弹窗：底部抽屉化，避免内容被左右裁切。 */
  .dv-mask, .ld-mask, .fm-mask, .ig-mask, .ad-mask { align-items: flex-end; padding: 10px; }
  .dv-dialog, .ld-dialog, .fm-dialog, .ig-dialog, .ad-dialog {
    width: 100%; max-width: 100%; max-height: 88dvh; overflow-y: auto; border-radius: 14px;
  }
}
@media (min-width: 769px), (pointer: fine) and (hover: hover) {
  .hide-desktop { display: none !important; }
  .mobile-only { display: none !important; }
}
@media (max-width: 768px) and (pointer: coarse), (max-width: 768px) and (hover: none) {
  .mobile-only { display: revert; }
}

/* 最终优先级：短剧流程不能被后续通用规则挤回横向滚动。 */
@media (max-width: 768px) and (pointer: coarse), (max-width: 768px) and (hover: none) {
  .dv-phase {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: visible; gap: 4px; padding: 5px 10px;
  }
  .dv-phase-btn {
    width: auto; min-width: 0; min-height: 42px; padding: 5px 2px;
    font-size: 0; white-space: normal; justify-content: center; text-align: center;
  }
  .dv-phase-btn::after { font-size: 11px; line-height: 1; }
  .dv-phase-btn:nth-child(1)::after { content: '想法与设定'; }
  .dv-phase-btn:nth-child(2)::after { content: '安排每集'; }
  .dv-phase-btn:nth-child(3)::after { content: '写剧本'; }
  .dv-phase-btn:nth-child(4)::after { content: '检查导出'; }
}

/* 短剧手机端样板：只呈现当前任务，避免把流程、设置和工具同时塞给用户。 */
@media (max-width: 768px) and (pointer: coarse), (max-width: 768px) and (hover: none) {
  body.dv-on { --tab-h: 0px; }
  body.dv-on .sa-tabs { display: none !important; }
  body.dv-on .dv-shell { height: calc(100dvh - var(--nav-h)); }
  body.dv-on .dv-left, body.dv-on .dv-mobile-flow { display: none !important; }
  body.dv-on .dv-head { min-height: 52px; padding: 10px 14px; }
  body.dv-on .dv-label { flex: 1; order: 0; font-size: 0; letter-spacing: 0; }
  body.dv-on .dv-label::after { font-family: var(--font-s); font-size: 15px; font-weight: 600; color: var(--ink); }
  body.dv-on[data-dv-stage="idea"] .dv-label::after { content: '第 1 步 · 说清你的想法'; }
  body.dv-on[data-dv-stage="outline"] .dv-label::after { content: '第 2 步 · 排分集大纲'; }
  body.dv-on[data-dv-stage="script"] .dv-label::after { content: '第 3 步 · 写每一集的剧本'; }
  body.dv-on[data-dv-stage="export"] .dv-label::after { content: '第 4 步 · 检查与导出'; }
  body.dv-on .dv-head .dv-modelwrap { display: none; }
  body.dv-on .dv-head #v3Export { display: none; }
  body.dv-on .dv-body { padding: 0; }
  body.dv-on .dv-msgs { padding: 20px 18px 10px; }
  body.dv-on .dv-msgs.welcome { justify-content: center; }
  body.dv-on .dv-welcome { max-width: none; text-align: left; }
  body.dv-on .dv-welcome .wt { font-size: 24px; line-height: 1.35; }
  body.dv-on .dv-welcome .ws { max-width: 31em; margin-bottom: 0; font-size: 15px; line-height: 1.75; }
  body.dv-on .dv-quickstart-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 14px; }
  body.dv-on .dv-quickstart-row span { display: none; }
  body.dv-on .dv-quickstart-row #v3QuickBtn { width: 100%; min-height: 46px; border-radius: 10px; border: 0; background: var(--accent); color: #0a1020; font-weight: 700; }
  body.dv-on .dv-inrow { padding: 8px 14px max(12px, env(safe-area-inset-bottom, 0px)); background: var(--bg-mid); border-top: 1px solid var(--line); }
  body.dv-on .dv-inrow .btn-sm { min-height: 44px; }
  body.dv-on .v3-wrap { padding: 12px 14px 24px; }
  body.dv-on .v3-arc-wrap > .v3-card { margin-bottom: 10px; }
  body.dv-on .v3-card-head { gap: 10px; }
  body.dv-on .v3-card-head .btn-sm, body.dv-on #v3Run { min-height: 46px; }
}

/* 手机端只展示此刻需要做的决定：技术选项、重复入口和全景面板退到下一层。 */
@media (max-width: 768px) and (pointer: coarse), (max-width: 768px) and (hover: none) {
  /* 长剧：先聊故事；设定需要查看时才切换，不把对话和九宫格并排塞给用户。 */
  body.ld-on .ld-model, body.ld-on .ld-ready, body.ld-on .ld-steps { display: none !important; }
  body.ld-on .ld-top { min-height: 52px; padding: 0 14px; }
  body.ld-on .ld-proj { margin-left: auto; font-size: 12px; }
  body.ld-on .ld-shell { display:flex; flex-direction:column; min-height:0 !important; }
  body.ld-on .ld-dual { display: block !important; flex:1 1 auto; height:auto; min-height:0; }
  body.ld-on .ld-cabin-l { display: flex; height: 100%; border: 0; }
  body.ld-on .ld-cabin-r { display: none; height: 100%; }
  body.ld-on .ld-show-settings .ld-cabin-l { display: none; }
  body.ld-on .ld-show-settings .ld-cabin-r { display: flex; flex-direction: column; }
  body.ld-on .ld-cabin-head { padding: 12px 14px; font-size: 15px; }
  body.ld-on .ld-chatlog { flex: 1; padding: 16px 14px; }
  body.ld-on .ld-inrow { padding: 8px 14px; }
  body.ld-on .ld-mobile-actions { display: flex; gap: 8px; padding: 0 14px max(12px, env(safe-area-inset-bottom, 0px)); }
  body.ld-on .ld-mobile-actions .ld-btn { flex: 1; min-height: 44px; }
  body.ld-on .ld-mobile-back { display: block; width: 100%; margin-top: 8px; }
  body.ld-on .ld-cabin-r .ld-form { overflow: auto; padding: 12px 14px; }
  body.ld-on .ld-cabin-r .ld-form-foot { padding: 10px 14px max(12px, env(safe-area-inset-bottom, 0px)); }

  /* 电影：默认只留“说想法”，另外两种组织方式不抢首屏注意力。 */
  body.fm-on .fm-model, body.fm-on .fm-proj, body.fm-on .fm-save, body.fm-on .fm-core, body.fm-on .fm-steps { display: none !important; }
  body.fm-on .fm-top { min-height: 52px; padding: 0 14px; }
  body.fm-on .fm-mode-bar { display: none; }
  body.fm-on .fm-one { height: calc(100dvh - var(--nav-h) - var(--tab-h)); overflow: hidden; }
  body.fm-on .fm-left { height: 100%; display: flex; flex-direction: column; }
  body.fm-on .fm-left .fm-panel-head { padding: 12px 14px; font-size: 15px; }
  body.fm-on .fm-view { min-height: 0; }
  body.fm-on .fm-view#viewChat.on { display: flex; flex: 1; flex-direction: column; }
  body.fm-on .fm-chatlog { flex: 1; overflow: auto; padding: 16px 14px; }
  body.fm-on .fm-track { padding: 8px 14px; }
  body.fm-on .fm-note { display: none; }
  body.fm-on .fm-blueprint { display: none; }

  /* 互动影游：一句话入口和对话输入重复，保留对话这一个主入口即可。 */
  body.ig-on .ig-model, body.ig-on .ig-steps-nav, body.ig-on .ig-oneshot, body.ig-on .ig-progress { display: none !important; }
  body.ig-on .ig-top { min-height: 52px; padding: 0 14px; }
  body.ig-on .sa-nav-placeholder { display:none; }
  body.ig-on .ig-shell { display:flex; flex-direction:column; min-height:0 !important; }
  body.ig-on .ig-top { flex:0 0 52px; }
  body.ig-on .ig-chatwrap { display:flex; flex:1 1 auto; height:auto; min-height:0; flex-direction:column; }
  body.ig-on .ig-chatlog { flex:1 1 auto; min-height:0; overflow:auto; padding:16px 14px; }
  body.ig-on .ig-inrow { flex:0 0 auto; }
  body.ig-on .ig-inrow { padding: 8px 14px max(12px, env(safe-area-inset-bottom, 0px)); }
  body.ig-on .ig-inrow { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; }
  body.ig-on .ig-inrow .ig-input { grid-column:auto; min-width: 0; min-height: 44px; }
  body.ig-on .ig-inrow .ig-btn { min-height: 44px; padding: 0 10px; }
  body.ig-on .ig-float-next #igNext { display: none !important; }
  body.ig-on .ig-float-next { bottom: calc(var(--tab-h) + 14px); }

  /* 带货：识图模型和完整步骤由系统处理；首屏只留产品描述和可选图片。 */
  body.ad-on .ad-proj, body.ad-on .ad-model, body.ad-on .ad-core, body.ad-on .ad-steps, body.ad-on .ad-visionbar { display: none !important; }
  body.ad-on .ad-top { min-height: 52px; padding: 0 14px; }
  body.ad-on .ad-upzone { margin: 10px 14px; min-height: 96px; padding: 16px 14px; border-radius: 12px; }
  body.ad-on .ad-left-scroll { padding-top: 4px; }
}

/* 手机首页使用独立 DOM 与流程，不再缩放或裁切桌面 Hero。 */
.mobile-landing { display: none; }
@media (max-width: 768px) and (pointer: coarse), (max-width: 768px) and (hover: none) {
  body.home-page:not(.home-authed) {
    --mobile-accent: #3867e8;
    background: #f4f6fa;
  }
  body.home-page:not(.home-authed) > .hero,
  body.home-page:not(.home-authed) > .workspace,
  body.home-page:not(.home-authed) > .sa-nav,
  body.home-page:not(.home-authed) > .sa-tabs,
  body.home-page:not(.home-authed) > .accent-dock { display: none !important; }
  body.home-page:not(.home-authed) .lobby-bg {
    background:
      radial-gradient(110% 58% at 86% -4%, rgba(56,103,232,.17), transparent 68%),
      radial-gradient(90% 42% at -12% 34%, rgba(90,181,255,.11), transparent 70%),
      #f4f6fa;
  }
  body.home-page:not(.home-authed) .lobby-bg-fallback,
  body.home-page:not(.home-authed) .lobby-bg-tint,
  body.home-page:not(.home-authed) .lobby-bg-veil { display: none; }
  body.home-page:not(.home-authed) .mobile-landing {
    position: relative;
    z-index: 2;
    display: block;
    min-height: 100svh;
    padding: env(safe-area-inset-top,0px) 0 env(safe-area-inset-bottom,0px);
    color: #172033;
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
  }
  .mobile-landing-head {
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
  }
  .mobile-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
  .mobile-brand img { width: 32px; height: 32px; }
  .mobile-brand span,.mobile-brand b,.mobile-brand small { display: block; }
  .mobile-brand b { color: #172033; font-family: var(--font-s); font-size: 14px; line-height: 1.2; }
  .mobile-brand small { margin-top: 2px; color: #7a8597; font-size: 9px; line-height: 1.2; }
  .mobile-login-link {
    min-width: 60px;
    min-height: 40px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(48,65,94,.13);
    border-radius: 999px;
    color: #46536a;
    background: rgba(255,255,255,.72);
    font-size: 13px;
    text-decoration: none;
  }
  .mobile-landing-hero {
    position: relative;
    margin: 4px 14px 0;
    padding: 30px 22px 20px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.88);
    border-radius: 28px;
    background: linear-gradient(150deg,rgba(255,255,255,.96),rgba(239,244,253,.9));
    box-shadow: 0 22px 56px rgba(43,68,115,.12);
  }
  .mobile-hero-glow {
    position: absolute;
    right: -72px;
    top: -84px;
    width: 210px;
    height: 210px;
    border-radius: 50%;
    background: radial-gradient(circle,rgba(74,119,241,.28),rgba(88,185,255,.10) 48%,transparent 70%);
    pointer-events: none;
  }
  .mobile-hero-kicker {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 18px;
    color: #5571b4;
    font-family: var(--font-m);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .16em;
  }
  .mobile-hero-kicker i { width: 7px; height: 7px; border-radius: 50%; background: #4d75ec; box-shadow: 0 0 0 5px rgba(77,117,236,.10); }
  .mobile-landing-hero h1 {
    position: relative;
    margin: 0;
    color: #151d2d;
    font-family: var(--font-s);
    font-size: clamp(36px,10.5vw,46px);
    font-weight: 900;
    line-height: 1.18;
    letter-spacing: -.045em;
  }
  .mobile-landing-hero h1 em { color: var(--mobile-accent); font-style: normal; }
  .mobile-hero-copy { position: relative; max-width: 290px; margin: 16px 0 21px; color: #657185; font-size: 14px; line-height: 1.75; }
  .mobile-hero-action {
    position: relative;
    width: 100%;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 17px;
    border-radius: 15px;
    color: #fff;
    background: #315fdb;
    box-shadow: 0 13px 28px rgba(49,95,219,.24);
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
  }
  .mobile-hero-action span { font-size: 18px; }
  .mobile-hero-preview {
    position: relative;
    margin-top: 18px;
    padding: 15px;
    border: 1px solid rgba(50,72,111,.09);
    border-radius: 16px;
    background: rgba(247,249,253,.82);
  }
  .mhp-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; color: #778397; font-size: 10px; }
  .mhp-top b { color: #315fdb; font-family: var(--font-m); font-size: 9px; letter-spacing: .08em; }
  .mhp-line { width: 73%; height: 6px; margin-top: 7px; border-radius: 999px; background: #dfe5ef; }
  .mhp-line.wide { width: 94%; }.mhp-line.short { width: 52%; }
  .mhp-status { display: flex; align-items: center; gap: 7px; margin-top: 14px; color: #748095; font-size: 10px; }
  .mhp-status i { width: 6px; height: 6px; border-radius: 50%; background: #27aa78; box-shadow: 0 0 0 4px rgba(39,170,120,.09); }
  .mobile-mode-section { padding: 34px 14px 30px; scroll-margin-top: 8px; }
  .mobile-mode-section > header { display: flex; align-items: flex-end; justify-content: space-between; padding: 0 5px; margin-bottom: 15px; }
  .mobile-mode-section > header small { color: #315fdb; font-family: var(--font-m); font-size: 8px; letter-spacing: .15em; }
  .mobile-mode-section > header h2 { margin: 4px 0 0; color: #172033; font-family: var(--font-s); font-size: 23px; }
  .mobile-mode-section > header > span { color: #8a95a7; font-size: 11px; }
  .mobile-mode-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
  .mobile-mode-card {
    position: relative;
    min-width: 0;
    min-height: 104px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    padding: 13px;
    overflow: hidden;
    border: 1px solid rgba(49,67,97,.11);
    border-radius: 18px;
    color: #273247;
    background: rgba(255,255,255,.80);
    box-shadow: 0 8px 24px rgba(42,61,94,.055);
    text-align: left;
    transition: border-color .16s,background .16s,transform .12s,box-shadow .16s;
  }
  .mobile-mode-card:active { transform: scale(.98); }
  .mobile-mode-card.active { border-color: rgba(49,95,219,.48); background: #fff; box-shadow: 0 12px 28px rgba(49,95,219,.12); }
  .mobile-mode-card .mmc-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 10px; color: #315fdb; background: #edf2ff; font-family: var(--font-s); font-size: 14px; font-style: normal; }
  .mobile-mode-card span { min-width: 0; }
  .mobile-mode-card b,.mobile-mode-card small { display: block; }
  .mobile-mode-card b { margin-top: 11px; color: #202b3e; font-size: 14px; }
  .mobile-mode-card small { margin-top: 2px; overflow: hidden; color: #8590a2; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-mode-card em { position: absolute; right: 11px; top: 11px; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; color: transparent; background: #edf0f5; font-size: 11px; font-style: normal; }
  .mobile-mode-card.active em { color: #fff; background: #315fdb; }
  .mobile-selection-summary { display: flex; align-items: center; gap: 14px; margin: 17px 1px 10px; padding: 13px 14px; border-radius: 15px; background: #e9eef8; }
  .mobile-selection-summary span { flex: 0 0 58px; }
  .mobile-selection-summary small,.mobile-selection-summary b { display: block; }
  .mobile-selection-summary small { color: #8490a3; font-size: 9px; }.mobile-selection-summary b { margin-top: 2px; color: #315fdb; font-size: 14px; }
  .mobile-selection-summary p { margin: 0; color: #667286; font-size: 11px; line-height: 1.55; }
  .mobile-start-button { width: 100%; min-height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border: 0; border-radius: 15px; color: #fff; background: #172033; font-size: 15px; font-weight: 750; }
  .mobile-start-button span { font-size: 19px; }
  .mobile-login-note { margin: 11px 0 0; color: #9099a8; font-size: 10px; text-align: center; }

  html:not(.theme-light) body.home-page:not(.home-authed) { background: #0e141f; }
  html:not(.theme-light) body.home-page:not(.home-authed) .lobby-bg { background: radial-gradient(100% 55% at 90% -5%,rgba(79,119,230,.18),transparent 68%),#0e141f; }
  html:not(.theme-light) .mobile-landing { color: #e8edf5; }
  html:not(.theme-light) .mobile-brand b,
  html:not(.theme-light) .mobile-landing-hero h1,
  html:not(.theme-light) .mobile-mode-section > header h2 { color: #edf2f8; }
  html:not(.theme-light) .mobile-login-link { color: #b8c2d1; background: rgba(255,255,255,.045); border-color: rgba(255,255,255,.10); }
  html:not(.theme-light) .mobile-landing-hero { background: linear-gradient(150deg,#171f2d,#111927); border-color: rgba(255,255,255,.08); box-shadow: 0 24px 58px rgba(0,0,0,.3); }
  html:not(.theme-light) .mobile-hero-copy { color: #a0abbb; }
  html:not(.theme-light) .mobile-hero-preview { background: rgba(255,255,255,.035); border-color: rgba(255,255,255,.07); }
  html:not(.theme-light) .mhp-line { background: rgba(255,255,255,.10); }
  html:not(.theme-light) .mobile-mode-card { color: #dfe6ef; background: rgba(23,31,45,.86); border-color: rgba(255,255,255,.08); box-shadow: none; }
  html:not(.theme-light) .mobile-mode-card.active { background: #1a2537; border-color: rgba(109,150,255,.48); }
  html:not(.theme-light) .mobile-mode-card b { color: #edf2f8; }
  html:not(.theme-light) .mobile-mode-card .mmc-icon { color: #91afff; background: rgba(109,150,255,.11); }
  html:not(.theme-light) .mobile-mode-card em { background: rgba(255,255,255,.07); }
  html:not(.theme-light) .mobile-selection-summary { background: rgba(255,255,255,.055); }
  html:not(.theme-light) .mobile-selection-summary p { color: #a0abbc; }
  html:not(.theme-light) .mobile-start-button { color: #111827; background: #e7ecf5; }
}

/* 2026-07 mobile guest entry: one focused onboarding screen. */
@media (max-width: 768px) and (pointer: coarse), (max-width: 768px) and (hover: none) {
  body.home-page:not(.home-authed) .mobile-landing {
    min-height:100svh;
    background:#f7f9fc;
  }
  .mobile-entry-screen {
    width:min(100%,390px);
    min-height:100svh;
    margin:0 auto;
    box-sizing:border-box;
    display:flex;
    flex-direction:column;
    justify-content:center;
    align-items:center;
    padding:max(24px,env(safe-area-inset-top,0px)) 24px max(30px,calc(18px + env(safe-area-inset-bottom,0px)));
  }
  .mobile-entry-visual {
    width:100%;
    height:clamp(250px,38svh,310px);
    flex:0 0 auto;
    display:grid;
    place-items:center;
    background:transparent;
  }
  .mobile-entry-pages { position:relative; width:min(70vw,276px); aspect-ratio:1; }
  .mep-sheet {
    position:absolute;
    display:block;
    width:68%;
    height:82%;
    border:1px solid rgba(34,114,211,.12);
    border-radius:52px 52px 76px 34px;
    transform-origin:74% 18%;
  }
  .mep-sheet-4 { left:26%; top:4%; background:#edf3fb; transform:rotate(17deg); opacity:.82; }
  .mep-sheet-3 { left:21%; top:7%; background:#dce8f8; transform:rotate(11deg); opacity:.92; }
  .mep-sheet-2 { left:15%; top:12%; background:#bfd4f2; transform:rotate(5deg); opacity:.96; }
  .mep-sheet-1 {
    left:7%;
    top:17%;
    overflow:hidden;
    background:linear-gradient(145deg,#4b88df 0%,#315fdb 100%);
    border-color:rgba(255,255,255,.24);
    box-shadow:0 24px 48px rgba(49,95,219,.17);
    transform:rotate(-2deg);
  }
  .mep-sheet-1::before,.mep-sheet-1::after {
    content:"";
    position:absolute;
    border:1px solid rgba(255,255,255,.35);
    border-left:0;
    border-bottom:0;
    border-radius:0 70px 0 0;
    transform:rotate(8deg);
  }
  .mep-sheet-1::before { width:150px; height:210px; right:-24px; top:42px; }
  .mep-sheet-1::after { width:118px; height:178px; right:12px; top:70px; opacity:.55; }
  .mep-core {
    position:absolute;
    left:1%;
    top:10%;
    z-index:5;
    width:26%;
    aspect-ratio:1;
    display:flex;
    flex-direction:column;
    justify-content:center;
    gap:7%;
    padding:0 7%;
    box-sizing:border-box;
    border:1px solid rgba(255,255,255,.52);
    border-radius:27px;
    background:#315fdb;
    box-shadow:0 16px 32px rgba(49,95,219,.22);
    transform:rotate(-5deg);
  }
  .mep-core i { display:block; height:3px; border-radius:3px; background:rgba(255,255,255,.9); }
  .mep-core i:nth-child(2) { width:72%; }
  .mep-core i:nth-child(3) { width:46%; }
  .mobile-entry-copy { width:100%; max-width:342px; margin:18px 0 0; padding:1px 0 1px 15px; text-align:left; position:relative; z-index:1; border-left:3px solid #315fdb; }
  .mobile-entry-copy h1 {
    margin:0;
    color:#17233c;
    font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
    font-size:clamp(28px,8.2vw,34px);
    font-weight:700;
    line-height:1.2;
    letter-spacing:.055em;
    white-space:nowrap;
  }
  .mobile-entry-copy p { margin:15px 0 0; color:#68758a; font-size:12px; line-height:1.75; letter-spacing:.01em; }
  .mobile-entry-actions { width:100%; max-width:342px; display:grid; justify-items:center; gap:9px; margin-top:27px; }
  .mobile-entry-primary {
    width:100%;
    min-height:56px;
    display:grid;
    place-items:center;
    border-radius:18px;
    color:#fff;
    background:#315fdb;
    border:1px solid #315fdb;
    box-shadow:0 13px 28px rgba(49,95,219,.18);
    font-size:16px;
    font-weight:750;
    letter-spacing:.04em;
    text-decoration:none;
  }
  .mobile-entry-secondary {
    min-height:44px;
    display:grid;
    place-items:center;
    padding:0 18px;
    color:#53627a;
    font-size:13px;
    font-weight:650;
    text-decoration:none;
  }
  html:not(.theme-light) body.home-page:not(.home-authed) .mobile-landing {
    background:linear-gradient(180deg,#101824,#0c121b);
  }
  html:not(.theme-light) .mep-sheet-4 { background:#213654; }
  html:not(.theme-light) .mep-sheet-3 { background:#24486c; }
  html:not(.theme-light) .mep-sheet-2 { background:#27668e; }
  html:not(.theme-light) .mobile-entry-copy { border-left-color:#8cbcff; }
  html:not(.theme-light) .mobile-entry-copy h1 { color:#edf3fb; }
  html:not(.theme-light) .mobile-entry-copy p { color:#9aa8ba; }
  html:not(.theme-light) .mobile-entry-secondary { color:#9aa8ba; }
}

@media (max-height: 680px) and (max-width: 768px) and (pointer: coarse),
       (max-height: 680px) and (max-width: 768px) and (hover: none) {
  .mobile-entry-screen { padding-top:18px; padding-bottom:22px; }
  .mobile-entry-visual { height:230px; }
  .mobile-entry-pages { width:min(64vw,244px); }
  .mobile-entry-copy { margin-top:14px; }
  .mobile-entry-copy p { margin-top:11px; line-height:1.65; }
  .mobile-entry-actions { margin-top:20px; }
}

/* Mobile guest auth: the opening artwork resolves into the compact login wordmark. */
@media (max-width: 768px) and (pointer: coarse), (max-width: 768px) and (hover: none) {
  body.home-page:not(.home-authed) .mobile-landing {
    min-height:100svh;
    overflow:hidden;
    color:#17233c;
    background:
      radial-gradient(78% 42% at 92% 0,rgba(49,95,219,.10),transparent 72%),
      radial-gradient(62% 38% at 0 94%,rgba(95,168,220,.08),transparent 72%),
      #f6f8fc;
  }
  .mobile-entry-screen {
    position:relative;
    width:min(100%,430px);
    min-height:100svh;
    margin:0 auto;
    padding:max(26px,env(safe-area-inset-top,0px)) 22px max(24px,calc(14px + env(safe-area-inset-bottom,0px)));
    display:flex;
    flex-direction:column;
    justify-content:flex-start;
    align-items:stretch;
    overflow:hidden;
  }
  .mobile-brand-intro {
    position:fixed;
    left:50%;
    top:49%;
    z-index:20;
    width:min(calc(100vw - 44px),386px);
    display:flex;
    flex-direction:column;
    align-items:center;
    transform:translate(-50%,-50%);
    transform-origin:center;
    opacity:1;
    pointer-events:none;
  }
  .mobile-brand-intro::after {
    content:"";
    position:absolute;
    left:50%;top:40%;
    width:70px;height:70px;
    border-radius:50%;
    background:rgba(73,125,231,.18);
    filter:blur(18px);
    opacity:0;
    transform:translate(-50%,-50%) scale(.2);
  }
  .mobile-entry-visual {
    width:100%;
    height:clamp(220px,32svh,276px);
    display:grid;
    place-items:center;
    background:transparent;
  }
  .mobile-entry-book {
    position:relative;
    width:min(72vw,282px);
    height:min(48vw,188px);
    perspective:900px;
    transform-style:preserve-3d;
  }
  .meb-shadow {
    position:absolute;
    left:8%;right:8%;bottom:-18px;height:28px;
    border-radius:50%;
    background:rgba(35,61,112,.18);
    filter:blur(13px);
    transform:scaleX(.7);
  }
  .meb-cover,.meb-page {
    position:absolute;
    top:11%;
    width:50%;
    height:82%;
    transform-style:preserve-3d;
    backface-visibility:hidden;
  }
  .meb-cover { z-index:2; background:linear-gradient(145deg,#4a83e2,#315fdb); border:1px solid rgba(255,255,255,.22); }
  .meb-cover-left { right:50%; border-radius:26px 7px 9px 30px; transform-origin:right center; transform:rotateY(78deg); }
  .meb-cover-right { left:50%; border-radius:7px 26px 30px 9px; transform-origin:left center; transform:rotateY(-78deg); }
  .meb-page { z-index:3; background:linear-gradient(90deg,#e5ecf8,#fff 76%); border:1px solid rgba(67,96,148,.13); }
  .meb-page::after { content:""; position:absolute; inset:17% 15%; opacity:.52; background:repeating-linear-gradient(180deg,rgba(80,104,146,.22) 0 1px,transparent 1px 13px); }
  .meb-page-left-back,.meb-page-left-front { right:50%; border-radius:24px 5px 7px 27px; transform-origin:right center; }
  .meb-page-right-back,.meb-page-right-front { left:50%; border-radius:5px 24px 27px 7px; transform-origin:left center; }
  .meb-page-left-back { transform:rotateY(72deg) translateZ(3px); }
  .meb-page-right-back { transform:rotateY(-72deg) translateZ(3px); }
  .meb-page-left-front { z-index:4; transform:rotateY(68deg) translateZ(7px); }
  .meb-page-right-front { z-index:4; transform:rotateY(-68deg) translateZ(7px); }
  .meb-spine { position:absolute; left:50%; top:12%; z-index:7; width:2px; height:80%; background:linear-gradient(180deg,transparent,rgba(49,95,219,.34) 18% 82%,transparent); transform:translateX(-50%); opacity:0; }
  .meb-spark { position:absolute; left:50%; top:50%; z-index:8; width:48px; height:48px; fill:#315fdb; opacity:0; transform:translate(-50%,-50%) scale(.55); filter:drop-shadow(0 8px 13px rgba(49,95,219,.18)); }
  .mobile-entry-brand {
    margin:12px 0 0;
    display:flex;
    align-items:center;
    gap:13px;
    color:#315fdb;
    font-family:var(--font-m,"SFMono-Regular",Consolas,monospace);
  }
  .mobile-entry-brand strong {
    font-size:14px;
    font-weight:850;
    letter-spacing:.46em;
    transform:translateX(.23em);
  }
  .mobile-entry-brand i {
    display:block;
    width:26px;
    height:1px;
    background:linear-gradient(90deg,transparent,rgba(49,95,219,.55));
  }
  .mobile-entry-brand i:last-child { transform:scaleX(-1); }
  .mobile-entry-copy {
    width:100%;
    max-width:350px;
    margin:14px 0 0;
    padding:0;
    text-align:center;
    border:0;
  }
  .mobile-entry-copy h1 {
    font-size:clamp(29px,8.5vw,36px);
    letter-spacing:.04em;
  }
  .mobile-entry-copy p {
    max-width:330px;
    margin:14px auto 0;
    color:#6f7b8e;
    font-size:12px;
    line-height:1.7;
    letter-spacing:.01em;
  }
  .mobile-entry-dock {
    width:max-content;
    min-height:46px;
    display:flex;
    align-items:center;
    gap:10px;
    opacity:0;
    transform:translateY(-10px);
    transition:opacity .42s ease,transform .58s cubic-bezier(.22,1,.36,1);
  }
  .mobile-entry-dock svg { width:37px; height:37px; overflow:visible; }
  .mobile-entry-dock .spark-tile { fill:#315fdb; }
  .mobile-entry-dock .spark-book { fill:none; stroke:rgba(255,255,255,.6); stroke-width:1.25; stroke-linejoin:round; }
  .mobile-entry-dock .spark-glyph { fill:#fff; }
  .mobile-entry-dock span {
    color:#28344b;
    font-family:var(--font-m,"SFMono-Regular",Consolas,monospace);
    font-size:12px;
    font-weight:650;
    letter-spacing:.16em;
    white-space:nowrap;
  }
  .mobile-entry-dock strong { color:#315fdb; font-weight:850; }
  .mobile-entry-auth-copy {
    width:100%;
    margin:clamp(52px,9svh,78px) 0 16px;
    opacity:0;
    transform:translateY(18px);
    pointer-events:none;
    transition:opacity .46s ease .06s,transform .68s cubic-bezier(.22,1,.36,1) .04s;
  }
  .mobile-entry-auth-brand { margin:0 0 31px; text-align:center; }
  .mobile-entry-auth-brand strong {
    display:block;
    position:relative;
    width:max-content;
    margin:0 auto;
    color:#315fdb;
    font-family:var(--font-m,"SFMono-Regular",Consolas,monospace);
    font-size:21px;
    font-weight:850;
    line-height:1;
    letter-spacing:.52em;
    transform:translateX(.26em);
  }
  .mobile-entry-auth-brand strong::before {
    content:"✦";
    position:absolute;
    left:-20px;
    top:-8px;
    color:#78a1f0;
    font-size:9px;
    letter-spacing:0;
  }
  .mobile-entry-auth-brand span {
    display:block;
    margin-top:11px;
    color:#647189;
    font-size:11px;
    letter-spacing:.14em;
  }
  .mobile-entry-auth-copy h1 {
    margin:0;
    color:#17233c;
    font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
    font-size:clamp(27px,7.5vw,32px);
    font-weight:760;
    line-height:1.18;
    letter-spacing:.035em;
  }
  .mobile-entry-auth-copy p { margin:11px 0 0; color:#748094; font-size:11px; line-height:1.65; }
  .mobile-entry-login {
    width:100%;
    margin:0 0 auto;
    padding:0 0 18px;
    opacity:0;
    transform:translateY(24px);
    pointer-events:none;
    transition:opacity .5s ease .12s,transform .72s cubic-bezier(.22,1,.36,1) .08s;
  }
  body.home-page:not(.home-authed) #mobileEntryLoginMount .home-login-card {
    display:block!important;
    width:100%;
    max-width:none;
    margin:0;
    padding:27px 22px 22px;
    border:1px solid rgba(122,145,187,.18);
    border-radius:25px;
    background:rgba(255,255,255,.82);
    box-shadow:0 24px 60px rgba(38,55,91,.11);
    backdrop-filter:blur(20px);
    transform:none;
  }
  body.home-page:not(.home-authed) #mobileEntryLoginMount .home-login-card { display:flex!important; flex-direction:column; }
  #mobileEntryLoginMount .home-login-card:hover { box-shadow:0 24px 60px rgba(38,55,91,.11); }
  #mobileEntryLoginMount .home-login-title {
    margin:0 0 19px;
    color:#17233c;
    font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
    font-size:21px;
    font-weight:750;
    text-align:left;
    letter-spacing:.01em;
  }
  #mobileEntryLoginMount .home-login-title { order:1; }
  #mobileEntryLoginMount .home-login-field { order:2; }
  #mobileEntryLoginMount .home-forgot { order:3; }
  #mobileEntryLoginMount .home-login-submit { order:4; }
  #mobileEntryLoginMount .home-login-foot { order:5; }
  #mobileEntryLoginMount .home-login-tip { order:6; }
  #mobileEntryLoginMount .home-login-tabs {
    order:7;
    align-self:center;
    width:190px;
    margin:8px 0 0;
    padding:0;
    gap:16px;
    border-radius:0;
    background:transparent;
  }
  #mobileEntryLoginMount .home-login-tab {
    position:relative;
    height:28px;
    padding:0;
    color:#919bac;
    background:transparent;
    border-radius:0;
    font-size:10px;
    font-weight:600;
    box-shadow:none;
  }
  #mobileEntryLoginMount .home-login-tab.active { color:#315fdb; background:transparent; box-shadow:none; }
  #mobileEntryLoginMount .home-login-tab.active::after {
    content:"";
    position:absolute;
    left:50%;bottom:1px;
    width:14px;height:1px;
    background:#315fdb;
    transform:translateX(-50%);
  }
  #mobileEntryLoginMount .home-login-field { height:48px; margin-bottom:9px; border-radius:12px; }
  #mobileEntryLoginMount .home-login-submit {
    height:48px;
    margin-top:15px;
    border-radius:13px;
    background:#315fdb;
    box-shadow:0 12px 24px rgba(49,95,219,.18);
  }
  #mobileEntryLoginMount .home-login-foot { margin-top:13px; flex-direction:row; align-items:center; gap:10px; font-size:10px; }
  #mobileEntryLoginMount .home-login-tip { min-height:15px; margin-top:7px; font-size:11px; }
  .mobile-entry-screen.is-settled { overflow-y:auto; }
  .mobile-entry-screen.is-settled .mobile-brand-intro { display:none; }
  .mobile-entry-screen.is-settled .mobile-entry-auth-copy,
  .mobile-entry-screen.is-settled .mobile-entry-login { opacity:1; transform:none; pointer-events:auto; }
  .mobile-entry-screen.is-playing .mobile-brand-intro { animation:mobileBrandExit 3.15s cubic-bezier(.65,0,.16,1) both; }
  .mobile-entry-screen.is-playing .mobile-brand-intro::after { animation:mobileSparkWash 3.15s ease both; }
  .mobile-entry-screen.is-playing .mobile-entry-brand { animation:mobileNameExit 3.15s cubic-bezier(.65,0,.16,1) both; }
  .mobile-entry-screen.is-playing .mobile-entry-book { animation:bookSceneExit 3.15s cubic-bezier(.65,0,.16,1) both; }
  .mobile-entry-screen.is-playing .meb-cover-left { animation:bookCoverLeft 1.25s cubic-bezier(.22,1,.36,1) .12s both; }
  .mobile-entry-screen.is-playing .meb-cover-right { animation:bookCoverRight 1.25s cubic-bezier(.22,1,.36,1) .12s both; }
  .mobile-entry-screen.is-playing .meb-page-left-back { animation:bookPageLeft 1.05s cubic-bezier(.22,1,.36,1) .38s both; }
  .mobile-entry-screen.is-playing .meb-page-right-back { animation:bookPageRight 1.05s cubic-bezier(.22,1,.36,1) .5s both; }
  .mobile-entry-screen.is-playing .meb-page-left-front { animation:bookPageLeftFront 1.08s cubic-bezier(.22,1,.36,1) .64s both; }
  .mobile-entry-screen.is-playing .meb-page-right-front { animation:bookPageRightFront 1.08s cubic-bezier(.22,1,.36,1) .76s both; }
  .mobile-entry-screen.is-playing .meb-spine { animation:bookSpineIn .55s ease 1.05s both; }
  .mobile-entry-screen.is-playing .meb-spark { animation:bookSparkIn .72s cubic-bezier(.22,1,.36,1) 1.15s both,bookSparkBurst .78s cubic-bezier(.55,0,.2,1) 2.22s forwards; }
  .mobile-entry-screen.is-playing .meb-shadow { animation:bookShadowOpen 1.25s ease .12s both; }

  @keyframes mobileBrandExit {
    0%,86% { opacity:1; transform:translate(-50%,-50%); }
    100% { opacity:0; transform:translate(-50%,-50%); }
  }
  @keyframes mobileNameExit {
    0%,68% { opacity:1; transform:translateY(0); }
    100% { opacity:0; transform:translateY(72px) scale(.88); }
  }
  @keyframes mobileSparkWash {
    0%,66% { opacity:0; transform:translate(-50%,-50%) scale(.2); }
    80% { opacity:.82; }
    100% { opacity:0; transform:translate(-50%,-50%) scale(5.2); }
  }
  @keyframes bookCoverLeft { from{transform:rotateY(78deg)} to{transform:rotateY(-8deg)} }
  @keyframes bookCoverRight { from{transform:rotateY(-78deg)} to{transform:rotateY(8deg)} }
  @keyframes bookPageLeft { from{transform:rotateY(72deg) translateZ(3px)} to{transform:rotateY(-4deg) translateZ(3px)} }
  @keyframes bookPageRight { from{transform:rotateY(-72deg) translateZ(3px)} to{transform:rotateY(4deg) translateZ(3px)} }
  @keyframes bookPageLeftFront { from{transform:rotateY(68deg) translateZ(7px)} to{transform:rotateY(-12deg) translateZ(7px)} }
  @keyframes bookPageRightFront { from{transform:rotateY(-68deg) translateZ(7px)} to{transform:rotateY(12deg) translateZ(7px)} }
  @keyframes bookSpineIn { from{opacity:0} to{opacity:1} }
  @keyframes bookSparkIn { from{opacity:0;transform:translate(-50%,-50%) scale(.55) rotate(-18deg)} to{opacity:1;transform:translate(-50%,-50%) scale(1) rotate(0)} }
  @keyframes bookSparkBurst { from{opacity:1;transform:translate(-50%,-50%) scale(1)} to{opacity:0;transform:translate(-50%,-50%) scale(4.6)} }
  @keyframes bookSceneExit {
    0%,68% { opacity:1; transform:translateY(0) rotateX(0) scale(1); }
    82% { opacity:1; transform:translateY(-7px) rotateX(9deg) scale(.96); }
    100% { opacity:0; transform:translateY(-28px) rotateX(24deg) scale(.26); }
  }
  @keyframes bookShadowOpen { from{opacity:.25;transform:scaleX(.3)} to{opacity:1;transform:scaleX(1)} }

  html:not(.theme-light) body.home-page:not(.home-authed) .mobile-landing {
    color:#e8edf7;
    background:radial-gradient(75% 42% at 92% 0,rgba(77,116,214,.18),transparent 72%),#0f1622;
  }
  html:not(.theme-light) .mobile-entry-auth-copy h1,
  html:not(.theme-light) #mobileEntryLoginMount .home-login-title { color:#edf2fa; }
  html:not(.theme-light) .mobile-entry-auth-copy p,
  html:not(.theme-light) .mobile-entry-auth-brand span { color:#9aa8ba; }
  html:not(.theme-light) body.home-page:not(.home-authed) #mobileEntryLoginMount .home-login-card {
    border-color:rgba(255,255,255,.08);
    background:rgba(22,31,45,.88);
    box-shadow:0 24px 60px rgba(0,0,0,.24);
  }
  html:not(.theme-light) #mobileEntryLoginMount .home-login-tabs { background:rgba(255,255,255,.06); }
  html:not(.theme-light) #mobileEntryLoginMount .home-login-tab.active { background:#273247; color:#9ab8ff; }
  html:not(.theme-light) #mobileEntryLoginMount .home-login-field { border-color:rgba(255,255,255,.11); background:rgba(255,255,255,.04); }
  html:not(.theme-light) #mobileEntryLoginMount .home-login-field input,
  html:not(.theme-light) #mobileEntryLoginMount .home-country { color:#edf2fa; }
  html:not(.theme-light) #mobileEntryLoginMount .home-login-foot { color:#9aa8ba; }
}

@media (max-height: 700px) and (max-width: 768px) and (pointer: coarse),
       (max-height: 700px) and (max-width: 768px) and (hover: none) {
  .mobile-entry-screen { padding-top:max(14px,env(safe-area-inset-top,0px)); padding-bottom:max(14px,env(safe-area-inset-bottom,0px)); }
  .mobile-entry-auth-copy { margin:24px 0 11px; }
  .mobile-entry-auth-brand { margin-bottom:18px; }
  .mobile-entry-login { padding:0 0 8px; }
  body.home-page:not(.home-authed) #mobileEntryLoginMount .home-login-card { padding:20px 19px 16px; }
  #mobileEntryLoginMount .home-login-title { margin-bottom:13px; font-size:19px; }
  #mobileEntryLoginMount .home-login-field { height:43px; }
  #mobileEntryLoginMount .home-login-submit { height:44px; margin-top:11px; }
  #mobileEntryLoginMount .home-login-foot { margin-top:9px; }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-entry-screen .mobile-brand-intro,
  .mobile-entry-screen .mobile-entry-auth-copy,
  .mobile-entry-screen .mobile-entry-login { animation:none!important; transition:none!important; }
}

@media (max-width: 350px) and (pointer: coarse), (max-width: 350px) and (hover: none) {
  .mobile-landing-hero { margin-inline: 10px; padding-inline: 18px; }
  .mobile-mode-section { padding-inline: 10px; }
  .mobile-mode-card { min-height: 100px; padding: 11px; }
}

/* 已登录手机首页：全量类型卡片，不横滑、不重复预览、不使用遮挡内容的底部 Dock。 */
.mobile-workspace-bar,.mobile-workspace-head,.mobile-account-backdrop,.mobile-account-sheet,.mi-index,.mi-desc { display: none; }
@media (max-width: 768px) and (pointer: coarse), (max-width: 768px) and (hover: none) {
  body.home-page.home-authed { overflow-x: hidden; overflow-y: auto; }
  body.home-page.home-authed > .sa-nav,
  body.home-page.home-authed > .sa-tabs,
  body.home-page.home-authed > .accent-dock { display: none !important; }
  body.home-page.home-authed .workspace {
    min-height: 100svh;
    padding: 0 !important;
    overflow: visible;
    background: radial-gradient(100% 42% at 100% 0,color-mix(in srgb,var(--accent) 7%,transparent),transparent 66%),var(--bg) !important;
  }
  body.home-page.home-authed .lobby {
    width: 100%;
    max-width: none;
    padding: calc(16px + env(safe-area-inset-top,0px)) 16px calc(28px + env(safe-area-inset-bottom,0px)) !important;
  }
  body.home-page.home-authed .workspace-manifesto,
  body.home-page.home-authed .mode-mobile-guide,
  body.home-page.home-authed .mode-preview { display: none !important; }
  body.home-page.home-authed .mobile-workspace-bar {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 24px;
  }
  .mwb-home { min-width: 0; display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; }
  .mwb-wordmark-mark { width: 34px; height: 34px; flex: 0 0 auto; overflow: visible; color: var(--accent); }
  .mwb-wordmark-mark .spark-tile { fill: var(--accent); }
  .mwb-wordmark-mark .spark-book { fill:none; stroke:rgba(255,255,255,.58); stroke-width:1.25; stroke-linejoin:round; }
  .mwb-wordmark-mark .spark-glyph { fill:#fff; }
  .mwb-wordmark-copy,.mwb-wordmark-copy b,.mwb-wordmark-copy small { display: block; }
  .mwb-wordmark-copy b { color: var(--ink); font: 650 9px/1.05 var(--font-m); letter-spacing: .08em; white-space: nowrap; }
  .mwb-wordmark-copy b strong { font-weight: 850; letter-spacing: .11em; }
  .mwb-wordmark-copy small { margin-top: 4px; color: var(--ink-faint); font: 550 5.5px/1 var(--font-m); letter-spacing: .15em; white-space: nowrap; }
  .mwb-actions { display: flex; align-items: center; gap: 7px; }
  .mwb-actions > a,.mwb-actions > button {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line-md);
    border-radius: 12px;
    color: var(--ink-dim);
    background: color-mix(in srgb,var(--surface) 92%,transparent);
    box-shadow: 0 4px 14px rgba(35,50,79,.05);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }
  .mwb-actions > a:active,.mwb-actions > button:active { color: var(--accent); background: var(--accent-glow); transform: scale(.95); }
  .mwb-actions svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .mwb-profile span { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 9px; color: #fff; background: linear-gradient(135deg,var(--accent),#243d80); font-size: 11px; font-weight: 800; }
  html.theme-light .mwb-moon { display: none; }
  html:not(.theme-light) .mwb-sun { display: none; }
  body.home-page.home-authed .mobile-workspace-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 24px;
  }
  .mobile-workspace-head > div { min-width: 0; }
  .mobile-workspace-head small { display: block; margin-bottom: 6px; color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
  .mobile-workspace-head h1 { margin: 0; color: var(--ink); font-family: var(--font-s); font-size: 25px; line-height: 1.22; letter-spacing: -.03em; }
  .mobile-workspace-head p { margin: 6px 0 0; color: var(--ink-dim); font-size: 12px; line-height: 1.5; }
  .mobile-workspace-head nav { display: flex; gap: 7px; flex: 0 0 auto; }
  .mobile-workspace-head nav a {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line-md);
    border-radius: 12px;
    color: var(--ink-dim);
    background: color-mix(in srgb,var(--surface) 90%,transparent);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-workspace-head nav a:active { color: var(--accent); background: var(--accent-glow); transform: scale(.96); }
  .mobile-workspace-head nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
  body.home-page.home-authed .section-head { margin: 0 0 13px; }
  body.home-page.home-authed .section-title { font-size: 18px; }
  body.home-page.home-authed .section-sub { display: none; }
  body.home-page.home-authed .mode-split { display: block; margin: 0 0 30px; }
  body.home-page.home-authed .mode-list {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 10px;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }
  body.home-page.home-authed .mode-list::before { display: none; }
  body.home-page.home-authed .mode-item,
  body.home-page.home-authed .mode-item:first-child {
    position: relative;
    width: 100%;
    min-height: 112px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 9px;
    margin: 0;
    padding: 13px;
    overflow: hidden;
    border: 1px solid var(--line-md);
    border-radius: 17px;
    color: var(--ink);
    background: color-mix(in srgb,var(--surface) 94%,transparent);
    box-shadow: 0 7px 20px rgba(40,55,84,.055);
    transform: none !important;
    transition: transform .12s ease,border-color .15s ease,background .15s ease;
    touch-action: manipulation;
  }
  body.home-page.home-authed .mode-item:nth-child(even) { margin: 0; }
  body.home-page.home-authed .mode-item::before {
    inset: 0 auto auto 13px;
    width: 28px;
    height: 2px;
    background: var(--mc);
    opacity: .72;
  }
  body.home-page.home-authed .mode-item.active,
  body.home-page.home-authed .mode-item:hover {
    border-color: color-mix(in srgb,var(--mc) 30%,var(--line-md));
    background: color-mix(in srgb,var(--mc) 5%,var(--surface));
    box-shadow: 0 8px 22px rgba(40,55,84,.07);
    transform: none !important;
  }
  body.home-page.home-authed .mode-item:active { transform: scale(.985) !important; }
  body.home-page.home-authed .mi-index { display: none; }
  body.home-page.home-authed .mi-icon,
  body.home-page.home-authed .mode-item.active .mi-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 12px;
    color: var(--mc);
    background: color-mix(in srgb,var(--mc) 13%,var(--bg-soft));
    filter: none;
    opacity: 1;
  }
  body.home-page.home-authed .mi-icon svg { width: 20px; height: 20px; }
  body.home-page.home-authed .mi-text { min-width: 0; display: block; }
  body.home-page.home-authed .mi-name { display: block; color: var(--ink); font-size: 16px; font-weight: 750; line-height: 1.2; }
  body.home-page.home-authed .mi-en { display: block; margin-top: 3px; color: var(--ink-faint); font-family: var(--font-m); font-size: 8px; letter-spacing: .08em; }
  body.home-page.home-authed .mi-desc {
    display: none;
  }
  body.home-page.home-authed .mi-arrow,
  body.home-page.home-authed .mode-item.active .mi-arrow {
    position: absolute;
    right: 12px;
    top: 12px;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: var(--ink-faint);
    background: transparent;
    font-size: 15px;
    opacity: .7;
    transform: none;
  }
  body.home-page.home-authed .toolkit-head { margin-top: 0; }
  body.home-page.home-authed .tool-cards { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin: 0; }
  body.home-page.home-authed .tool-card { min-height: 116px; display: block; padding: 13px; border-radius: 17px; box-shadow: 0 7px 20px rgba(40,55,84,.05); }
  body.home-page.home-authed .tool-card::before { inset: 0 auto auto 13px; width: 28px; height: 2px; transform: none; opacity: .65; }
  body.home-page.home-authed .tool-card-icon { width: 36px; height: 36px; margin-bottom: 10px; border-radius: 11px; }
  body.home-page.home-authed .tool-card-icon svg { width: 19px; height: 19px; }
  body.home-page.home-authed .tool-card-meta { margin-bottom: 3px; font-size: 7px; }
  body.home-page.home-authed .tool-card-title { margin-bottom: 3px; font-size: 15px; }
  body.home-page.home-authed .tool-card-desc { display: block; overflow: hidden; color: var(--ink-dim); font-size: 10px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
  body.home-page.home-authed .tool-card-action { display: none; }

  body.home-page.home-authed .mobile-account-backdrop {
    position: fixed;
    inset: 0;
    z-index: 170;
    display: block;
    border: 0;
    background: rgba(6,10,18,.48);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .22s ease,visibility .22s ease;
  }
  body.home-page.home-authed .mobile-account-sheet {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: max(10px,env(safe-area-inset-bottom,0px));
    z-index: 171;
    display: block;
    padding: 10px 14px 14px;
    border: 1px solid var(--line-md);
    border-radius: 22px;
    background: var(--bg-mid);
    box-shadow: 0 24px 70px rgba(0,0,0,.28);
    transform: translateY(calc(100% + 24px));
    visibility: hidden;
    transition: transform .28s cubic-bezier(.22,1,.36,1),visibility .28s;
  }
  body.home-page.home-authed.mobile-account-open { overflow: hidden; }
  body.home-page.home-authed.mobile-account-open .mobile-account-backdrop { opacity: 1; visibility: visible; pointer-events: auto; }
  body.home-page.home-authed.mobile-account-open .mobile-account-sheet { transform: translateY(0); visibility: visible; }
  .mas-handle { width: 34px; height: 4px; margin: 0 auto 13px; border-radius: 99px; background: var(--line-strong); }
  .mas-profile { display: flex; align-items: center; gap: 12px; padding: 4px 3px 15px; border-bottom: 1px solid var(--line); }
  .mas-avatar { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 13px; color: #fff; background: linear-gradient(135deg,var(--accent),#243d80); font-size: 16px; font-weight: 800; }
  .mas-profile div { min-width: 0; }.mas-profile b,.mas-profile small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mas-profile b { color: var(--ink); font-size: 15px; }.mas-profile small { margin-top: 4px; color: var(--ink-faint); font-size: 11px; }
  .mas-links { display: grid; margin: 8px 0; }
  .mas-links a { min-height: 46px; display: flex; align-items: center; justify-content: space-between; padding: 0 4px; border-bottom: 1px solid var(--line); color: var(--ink); font-size: 13px; text-decoration: none; }
  .mas-links a b { color: var(--ink-faint); font-size: 20px; font-weight: 400; }
  .mas-logout { width: 100%; min-height: 44px; border: 1px solid rgba(185,45,55,.15); border-radius: 12px; color: #b52d38; background: rgba(185,45,55,.055); font-size: 13px; font-weight: 700; }
}

/* ================================================================
   2026-07 mobile refresh
   This final layer intentionally uses width-only breakpoints. It must remain
   last so newly added desktop page styles cannot undo the phone layout, and
   so phone-sized webviews that report a fine pointer stay fully usable.
   ================================================================ */
@media (max-width: 768px) {
  :root {
    --nav-h: calc(54px + env(safe-area-inset-top, 0px));
    --tab-h: calc(78px + env(safe-area-inset-bottom, 0px));
    --creative-project-h: 62px;
    --mobile-edge: clamp(12px, 4vw, 18px);
    --mobile-card-radius: 18px;
    --mobile-sheet-radius: 26px;
    --mobile-shadow: 0 14px 38px rgba(25, 36, 61, .11);
  }

  html {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
    scroll-padding-top: var(--nav-h);
  }
  body {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden !important;
  }
  body::after { display: none !important; }
  img, video, canvas, iframe { max-width: 100%; }
  button, a, input, textarea, select, summary { -webkit-tap-highlight-color: transparent; }
  button, [role="button"], summary, select { touch-action: manipulation; }
  input, textarea, select { max-width: 100%; }
  input:not([type="checkbox"]):not([type="radio"]),
  textarea,
  select {
    min-height: 44px;
    border-radius: 12px;
  }
  button,
  .btn,
  [class$="-btn"],
  [class*="-btn "],
  [class$="-primary"],
  [class$="-secondary"] {
    min-height: 44px;
  }
  :is(button,a,input,textarea,select,summary,[tabindex]):focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent, #315fdb) 28%, transparent);
    outline-offset: 2px;
  }

  /* One current brand mark and a calmer, safe-area-aware app bar. */
  .sa-nav,
  .sa-nav.is-scrolled {
    height: var(--nav-h);
    padding: env(safe-area-inset-top, 0px) 12px 0;
    gap: 8px;
    background: color-mix(in srgb, var(--bg-mid) 94%, transparent) !important;
    border-bottom: 1px solid color-mix(in srgb, var(--line-md) 86%, transparent);
    box-shadow: 0 6px 22px rgba(24, 35, 59, .07);
    backdrop-filter: blur(18px) saturate(1.08);
    -webkit-backdrop-filter: blur(18px) saturate(1.08);
  }
  .sa-nav-brand {
    min-width: 0;
    margin-right: auto;
    padding-right: 0;
    gap: 8px;
    border-right: 0;
  }
  .sa-nav-mark,
  html.theme-light .sa-nav-mark {
    position: relative;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    overflow: hidden;
    color: inherit;
    border-radius: 11px;
    filter: none;
  }
  .sa-nav-mark::before { display: none !important; }
  .sa-nav-mark img {
    width: 34px;
    height: 34px;
    display: block;
  }
  .sa-nav-name {
    display: inline !important;
    max-width: 92px;
    overflow: hidden;
    color: var(--ink);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .12em;
    text-overflow: ellipsis;
  }
  .sa-nav-links { display: none !important; }
  .sa-nav-right { min-width: 0; gap: 7px; }
  .sa-cloud-status {
    max-width: 72px;
    min-height: 32px;
    padding: 0 8px;
    overflow: hidden;
    font-size: 10px;
    text-overflow: ellipsis;
  }
  .sa-theme-btn,
  .sa-nav-menu {
    width: 42px;
    height: 42px;
    min-height: 42px;
    border: 1px solid var(--line-md);
    border-radius: 13px;
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    box-shadow: 0 4px 13px rgba(32, 45, 73, .06);
  }
  .sa-theme-btn svg,
  .sa-nav-menu svg { width: 18px; height: 18px; }

  /* Primary navigation behaves like a native bottom dock, not a desktop bar. */
  body > .sa-tabs {
    left: 10px;
    right: 10px;
    bottom: max(8px, env(safe-area-inset-bottom, 0px));
    width: auto;
    height: 60px;
    padding: 5px;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--line-md) 92%, transparent);
    border-radius: 20px;
    background: color-mix(in srgb, var(--bg-mid) 94%, transparent);
    box-shadow: 0 14px 42px rgba(20, 30, 52, .18);
    backdrop-filter: blur(20px) saturate(1.12);
    -webkit-backdrop-filter: blur(20px) saturate(1.12);
  }
  .sa-tab {
    min-width: 0;
    min-height: 50px;
    padding: 4px 3px;
    gap: 2px;
    border-radius: 15px;
    color: var(--ink-faint);
    text-transform: none;
  }
  .sa-tab svg { width: 21px; height: 21px; }
  .sa-tab span { font-size: 10px; font-weight: 650; letter-spacing: .02em; }
  .sa-tab.active {
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
  }
  .sa-tab.active::before { display: none; }
  .sa-tab:active { transform: scale(.96); }

  /* The former side drawer is now a thumb-friendly bottom sheet. */
  .sa-drawer-mask {
    display: block;
    padding: 10px;
    background: rgba(8, 13, 24, .52);
  }
  .sa-drawer {
    top: auto;
    left: 10px;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom, 0px));
    width: auto;
    max-width: 520px;
    max-height: min(82dvh, 720px);
    margin: 0 auto;
    padding: 10px 12px 16px;
    border: 1px solid var(--line-md);
    border-radius: var(--mobile-sheet-radius);
    background: var(--bg-mid);
    box-shadow: 0 28px 80px rgba(0, 0, 0, .30);
    transform: translateY(calc(100% + 28px));
    transition: transform .3s cubic-bezier(.22,1,.36,1);
  }
  .sa-drawer.open { transform: translateY(0); }
  .sa-drawer-head {
    min-height: 48px;
    margin-bottom: 4px;
    padding: 0 2px 8px 8px;
  }
  .sa-drawer-head::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 8px;
    width: 34px;
    height: 4px;
    border-radius: 99px;
    background: var(--line-strong);
    transform: translateX(-50%);
  }
  .sa-drawer-head b { padding-top: 8px; font-size: 10px; letter-spacing: .16em; }
  .sa-drawer-close {
    position: relative;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 13px;
  }
  .sa-close-icon,
  .sa-close-icon::before,
  .sa-close-icon::after {
    display: block;
    width: 17px;
    height: 1.8px;
    border-radius: 99px;
    background: currentColor;
  }
  .sa-close-icon { position: relative; background: transparent; }
  .sa-close-icon::before,
  .sa-close-icon::after { content: ""; position: absolute; inset: 0; margin: auto; }
  .sa-close-icon::before { transform: rotate(45deg); }
  .sa-close-icon::after { transform: rotate(-45deg); }
  .sa-drawer-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }
  .sa-drawer a,
  .sa-drawer button[data-theme-toggle] {
    min-height: 50px;
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    font-size: 13px;
  }
  .sa-drawer a svg,
  .sa-drawer button[data-theme-toggle] svg { width: 19px; height: 19px; }
  .sa-drawer-group-label {
    grid-column: 1 / -1;
    margin: 8px 5px 0;
    padding-top: 10px;
  }
  .sa-drawer a.sa-drawer-sub {
    min-height: 44px;
    padding: 9px 11px;
  }
  .sa-drawer-foot {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 9px;
    padding-top: 9px;
  }

  /* Shared cards, dialogs and dense data surfaces. */
  .sa-modal-overlay,
  .dv-overlay,
  .ld-mask,
  .ld-prev-mask,
  .fm-mask,
  .fm-prev-mask,
  .ad-mask {
    padding: 10px;
    align-items: flex-end;
  }
  .sa-modal,
  .dv-ov-card,
  .ld-dialog,
  .ld-pitch,
  .ld-prev,
  .fm-dialog,
  .fm-prev,
  .ad-dialog {
    width: 100%;
    max-width: 560px;
    max-height: min(86dvh, 760px);
    margin: 0 auto;
    padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
    border-radius: var(--mobile-sheet-radius);
    box-shadow: 0 28px 80px rgba(0,0,0,.28);
  }
  .works-grid,
  .account-grid,
  .me-grid,
  .admin-grid,
  .predict-grid,
  .analyze-grid,
  .concept-grid,
  .tools-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .works-page,
  .account-page,
  .me-page,
  .admin-page,
  .admin-shell,
  .predict-page,
  .analyze-page,
  .tools-page {
    width: 100%;
    padding-left: var(--mobile-edge) !important;
    padding-right: var(--mobile-edge) !important;
  }
  .work-card,
  .tools-card,
  .me-card,
  .account-card,
  .predict-card,
  .analyze-card {
    border-radius: var(--mobile-card-radius) !important;
    box-shadow: 0 8px 24px rgba(35, 48, 77, .07);
  }
  .admin-table-wrap,
  .table-wrap,
  [class*="-table-wrap"] {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  /* Creative workspaces use one app bar and one four-step project bar. */
  body.creative-workspace {
    --tab-h: 0px;
    --creative-project-h: 62px;
  }
  body.creative-workspace .sa-nav-brand,
  body.creative-workspace .sa-theme-btn { display: none !important; }
  body.creative-workspace .sa-nav-workspace-context {
    display: flex !important;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 42px;
  }
  body.creative-workspace .creative-back {
    width: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 1px solid var(--line-md);
    border-radius: 13px;
    background: var(--surface);
  }
  body.creative-workspace .creative-back span:last-child,
  body.creative-workspace .creative-mode-badge,
  body.creative-workspace .creative-context-divider,
  body.creative-workspace .creative-project-copy small { display: none !important; }
  .creative-back-icon {
    width: 10px;
    height: 10px;
    border-left: 1.8px solid currentColor;
    border-bottom: 1.8px solid currentColor;
    transform: rotate(45deg);
  }
  body.creative-workspace .creative-project-copy { min-width: 0; }
  body.creative-workspace .creative-project-copy strong {
    max-width: min(46vw, 260px);
    font-size: 13px;
  }
  body.creative-workspace .sa-nav-right { margin-left: 4px; }
  body.creative-workspace .sa-cloud-status { max-width: 58px; }
  .creative-project-shell {
    height: var(--creative-project-h);
    top: var(--nav-h);
    background: color-mix(in srgb, var(--bg) 97%, transparent);
    box-shadow: 0 8px 20px rgba(24, 35, 59, .06);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }
  .creative-shell-row {
    width: 100%;
    padding: 6px 7px;
    gap: 5px;
  }
  .creative-workflow {
    width: auto;
    height: 50px;
    min-width: 0;
    flex: 1 1 auto;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
  }
  .creative-step {
    min-width: 0;
    min-height: 48px;
    padding: 4px 2px;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    border-radius: 13px;
  }
  .creative-step::after { display: none; }
  .creative-step-index {
    width: 20px;
    height: 20px;
    flex-basis: 20px;
    font-size: 9px;
  }
  .creative-step-copy b {
    max-width: 100%;
    overflow: hidden;
    font-size: 9.5px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .creative-step-copy small { display: none; }
  .creative-project-spacer,
  .creative-stage-detail { display: none; }
  .creative-generation-settings { flex: 0 0 42px; }
  .creative-generation-settings > summary {
    position: relative;
    width: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 0;
    overflow: hidden;
    border-radius: 13px;
    font-size: 0;
  }
  .creative-generation-settings > summary::before {
    content: "";
    width: 18px;
    height: 14px;
    margin: auto;
    background:
      radial-gradient(circle at 5px 2px, currentColor 0 2px, transparent 2.4px),
      radial-gradient(circle at 13px 7px, currentColor 0 2px, transparent 2.4px),
      radial-gradient(circle at 7px 12px, currentColor 0 2px, transparent 2.4px),
      linear-gradient(currentColor,currentColor) 0 1.25px/18px 1.5px no-repeat,
      linear-gradient(currentColor,currentColor) 0 6.25px/18px 1.5px no-repeat,
      linear-gradient(currentColor,currentColor) 0 11.25px/18px 1.5px no-repeat;
  }
  .creative-generation-settings > summary::after { display: none; }
  .creative-generation-popover {
    top: calc(var(--nav-h) + var(--creative-project-h) + 7px);
    right: 8px;
    left: 8px;
    width: auto;
    max-height: calc(100dvh - var(--nav-h) - var(--creative-project-h) - 18px);
    padding: 18px;
    border-radius: 20px;
  }
  body.creative-workspace .studio,
  body.creative-workspace .dv-shell,
  body.creative-workspace .fm-shell,
  body.creative-workspace .ld-shell,
  body.creative-workspace .ig-app,
  body.creative-workspace .ig-shell,
  body.creative-workspace .ad-shell {
    margin-top: calc(var(--nav-h) + var(--creative-project-h)) !important;
    height: calc(100dvh - var(--nav-h) - var(--creative-project-h)) !important;
    min-height: 0 !important;
  }

  /* Every creative mode becomes a focused single-column phone workspace. */
  body.creative-workspace :is(.dv-fresh-card,.fm-fresh-card,.ld-fresh-card,.ig-start-card,.ig-setup,.ad-start-card) {
    width: calc(100% - 24px) !important;
    max-width: 620px;
    padding: 24px 18px !important;
    border-radius: 22px;
    box-shadow: var(--mobile-shadow);
  }
  body.creative-workspace :is(.dv-fresh-card,.fm-fresh-card,.ld-fresh-card,.ig-start-card,.ig-setup,.ad-start-card) h1 {
    font-size: clamp(28px, 8.8vw, 36px) !important;
    line-height: 1.16 !important;
    letter-spacing: -.035em;
  }
  body.creative-workspace :is(.dv-fresh-production-grid,.fm-fresh-production-grid,.ld-fresh-grid,.ig-form-grid,.ad-start-seeds) {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  body.creative-workspace :is(.dv-head,.fm-editor-bar,.ld-toolbar,.ig-jobbar,.ad-editor-bar,.v3w-actions) {
    max-width: 100%;
  }
  body.creative-workspace :is(.dv-head,.fm-editor-bar,.ld-toolbar,.ad-editor-bar) {
    padding: 9px 12px;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }
  body.creative-workspace :is(.dv-head,.fm-editor-bar,.ld-toolbar,.ad-editor-bar)::-webkit-scrollbar { display: none; }

  .dv-shell,
  .dv-shell.no-right,
  .dv-shell.v3w-shell {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .dv-left, .dv-right { display: none !important; }
  .dv-center { min-width: 0; min-height: 0; }
  .v3w-work {
    display: flex !important;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }
  .v3w-episode-rail {
    flex: 0 0 auto;
    max-height: 106px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .v3w-eplist {
    display: flex !important;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }
  .v3w-center, .v3w-script { min-width: 0; min-height: 0; }
  .v3w-script { padding: 18px var(--mobile-edge) 28px !important; }

  .ld-dual,
  .ld-smain,
  .ld-outline-main,
  .ld-expgrid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .ld-sleft { display: none !important; }
  .ld-paper, .ld-editor { max-width: 100%; padding: 18px var(--mobile-edge); }

  .fm-one,
  .fm-two,
  .fm-three,
  .fm-four,
  .fm-outline-layout,
  .fm-script-workspace,
  .fm-export-layout {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .fm-tree, .fm-scenes { display: none !important; }
  .fm-script, .fm-editor-scroll { max-width: 100%; }
  .fm-stage-intro,
  .fm-outline-layout,
  .fm-export-layout { padding-left: var(--mobile-edge) !important; padding-right: var(--mobile-edge) !important; }
  .fm-stage-intro { align-items: stretch; gap: 14px; }
  .fm-stage-copy h1 { font-size: clamp(24px, 7.4vw, 32px); }

  .ig-outline-layout,
  .ig-delivery-grid,
  .ig-writing {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .ig-outline-head,
  .ig-delivery-head {
    padding-left: var(--mobile-edge) !important;
    padding-right: var(--mobile-edge) !important;
  }
  .ig-head-actions { width: 100%; display: grid; grid-template-columns: minmax(0,1fr); }
  .ig-writing { display: flex !important; min-height: 0; }
  .ig-rail, .ig-brain {
    width: min(86vw, 330px);
    max-width: 330px;
  }
  .ig-jobbar {
    padding: 8px 10px;
    gap: 7px;
    overflow-x: auto;
  }
  .ig-jobbar > div:first-child { min-width: 128px; }

  .ad-one,
  .ad-two,
  .ad-three,
  .ad-four,
  .ad-dwrap,
  .ad-planner {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .ad-one, .ad-work, .ad-expmain { padding: 12px var(--mobile-edge); }
  .ad-rail { display: none !important; }
  .ad-script, .ad-preview { max-width: 100%; padding-left: var(--mobile-edge); padding-right: var(--mobile-edge); }

  /* Keep the required AI notice visible without covering an editor. */
  .sa-ai-disclosure {
    left: auto !important;
    right: 8px !important;
    bottom: max(8px, env(safe-area-inset-bottom, 0px)) !important;
    width: auto;
    max-width: calc(100vw - 16px) !important;
    min-height: 34px;
    padding: 7px 9px !important;
    border-radius: 11px !important;
  }
  .sa-ai-disclosure span { display: none; }
  .sa-ai-disclosure strong,
  .sa-ai-disclosure a { font-size: 9px; }
  body:not(.creative-workspace) .sa-ai-disclosure {
    bottom: calc(var(--tab-h) + 2px) !important;
  }

  /* Normalize legacy text close controls that still arrive from older panels. */
  :is(
    .sa-modal-head button[aria-label="关闭"],
    .mobile-tool-sheet-head button[aria-label="关闭"],
    button[title="关闭"],
    .char-del-btn,
    .rel-tag-x,
    .char-remove,
    .faction-remove,
    .vol-remove-btn
  ):not(.sa-drawer-close) {
    position: relative;
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0 !important;
    overflow: hidden;
    border-radius: 12px;
    font-size: 0 !important;
  }
  :is(
    .sa-modal-head button[aria-label="关闭"],
    .mobile-tool-sheet-head button[aria-label="关闭"],
    button[title="关闭"],
    .char-del-btn,
    .rel-tag-x,
    .char-remove,
    .faction-remove,
    .vol-remove-btn
  ):not(.sa-drawer-close)::before,
  :is(
    .sa-modal-head button[aria-label="关闭"],
    .mobile-tool-sheet-head button[aria-label="关闭"],
    button[title="关闭"],
    .char-del-btn,
    .rel-tag-x,
    .char-remove,
    .faction-remove,
    .vol-remove-btn
  ):not(.sa-drawer-close)::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 1.8px;
    border-radius: 99px;
    background: currentColor;
  }
  :is(
    .sa-modal-head button[aria-label="关闭"],
    .mobile-tool-sheet-head button[aria-label="关闭"],
    button[title="关闭"],
    .char-del-btn,
    .rel-tag-x,
    .char-remove,
    .faction-remove,
    .vol-remove-btn
  ):not(.sa-drawer-close)::before { transform: translate(-50%,-50%) rotate(45deg); }
  :is(
    .sa-modal-head button[aria-label="关闭"],
    .mobile-tool-sheet-head button[aria-label="关闭"],
    button[title="关闭"],
    .char-del-btn,
    .rel-tag-x,
    .char-remove,
    .faction-remove,
    .vol-remove-btn
  ):not(.sa-drawer-close)::after { transform: translate(-50%,-50%) rotate(-45deg); }
}

@media (max-width: 374px) {
  :root { --mobile-edge: 11px; }
  .sa-nav-name { display: none !important; }
  body.creative-workspace .creative-project-copy strong { max-width: 38vw; }
  .creative-step-copy b { font-size: 8.5px; }
  .creative-step-index { width: 18px; height: 18px; flex-basis: 18px; }
  .sa-drawer-links,
  .sa-drawer-foot { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .sa-drawer,
  .sa-tab,
  .creative-step,
  .creative-generation-popover {
    scroll-behavior: auto;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}
