/*
 * 手机端（≤900px）的整套外观（2026-10-07 重整）
 * ------------------------------------------------------------
 * 只管手机：除了第 0 节把手机专用的元素在桌面上藏起来，其余每条规则都在 @media (max-width: 900px) 里，
 * 桌面（≥901px）一个像素都不受影响（tests/test_mobile_shell.py 锁住这条；改完再用逐像素比对看 1440 / 1280 / 1024）。
 * 本文件排在所有用户端样式表之后（base.html），靠「同特异性、后加载」覆盖；个别旧规则带 !important 的，这里同样带。
 * 769–900px 原来是第三套（平板）布局，已并进手机布局：dashboard-preview.css 的手机断点同样是 900。
 *
 *   1. 外壳：顶栏 + 菜单抽屉（templates/_mobile_shell.html，宿主页和其它用户页共用一份；行为在 app-shell.js）
 *   2. 宿主页（生成页 / 工作台 / 次要页面 iframe）的整体布局
 *   3. 对话记录抽屉
 *   4. 生成页：任务流
 *   5. 生成页：输入栏与参数选择（底部弹出面板）
 *   6. 次要页面（设置 / 通知 / 模型价格 / 开发者 / API 结果 / 推广 / 抽奖）——⚠️ 会在 iframe 里生效，见该节说明
 *   7. 弹窗
 *   9. 官网首页与登录
 * 工作台（项目库 / 素材库）与画布的手机样式在前端包各组件里（flow-web，同一条 900px 断点，services/viewport.ts）。
 */

/* ── 0. 手机专用元素：桌面不显示 ─────────────────────────── */
.m-shell,
.m-drawer,
.m-scrim,
.m-sheet-scrim,
.m-only {
  display: none;
}

@media (max-width: 900px) {
  /* ── 1. 外壳 ─────────────────────────────────────────────── */
  body.nf-theme {
    --m-top-h: 52px;
    --m-radius: 14px;
    --m-card: #141417;
    --m-card-2: #1b1b1f;
    --m-line: rgba(255, 255, 255, 0.07);
    --m-line-2: rgba(255, 255, 255, 0.12);
    --m-ink: #f2f2f4;
    --m-ink-2: #c9c9cf;
    --m-muted: #8d8d96;
    --m-blue: #2563eb;
    --m-blue-ink: #7aa7ff;
    --m-gift: #34d39a;
    -webkit-tap-highlight-color: transparent;
  }

  body.nf-theme .m-shell {
    display: block;
    position: sticky;
    top: 0;
    z-index: 60;
    background: var(--nf-bg, #08080b);
  }

  html.nf-in-frame body.nf-theme .m-shell,
  html.nf-in-frame body.nf-theme .m-drawer,
  html.nf-in-frame body.nf-theme .m-scrim {
    display: none !important;
  }

  body.nf-theme .m-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    height: calc(var(--m-top-h) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 12px 0;
    border-bottom: 1px solid var(--m-line);
    background: var(--nf-bg, #08080b);
  }

  body.nf-theme .m-icon-btn {
    position: relative;
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--m-line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--m-ink);
    cursor: pointer;
  }

  body.nf-theme .m-icon-btn:active {
    background: rgba(255, 255, 255, 0.08);
  }

  /* 打开抽屉时焦点会挪到「关闭」上：只给键盘操作画焦点环，点按的不画 */
  body.nf-theme :is(.m-icon-btn, .m-wallet, .m-nav-item, .m-btn, .m-lang-options button):focus {
    outline: none;
  }

  body.nf-theme :is(.m-icon-btn, .m-wallet, .m-nav-item, .m-btn, .m-lang-options button):focus-visible {
    outline: 2px solid rgba(96, 165, 250, 0.75);
    outline-offset: 2px;
  }

  body.nf-theme .m-icon-btn svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  body.nf-theme .m-badge-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 0 0 0 2px var(--nf-bg, #08080b);
  }

  body.nf-theme .m-brand.brand {
    flex: none;
    gap: 8px;
    font-size: 17px;
    line-height: 1;
  }

  body.nf-theme .m-topbar-end {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin-left: auto;
  }

  body.nf-theme .m-wallet {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    height: 36px;
    padding: 0 5px 0 12px;
    border: 1px solid var(--m-line-2);
    border-radius: 999px;
    background: var(--m-card);
    color: var(--m-ink);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
  }

  body.nf-theme .m-wallet-label {
    color: var(--m-muted);
    font-size: 12px;
  }

  body.nf-theme .m-wallet-value {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  body.nf-theme .m-wallet-plus {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--m-blue);
    color: #fff;
    font-size: 17px;
    font-weight: 500;
    line-height: 1;
  }

  /* 只在生成视图出现「对话记录」 */
  body.nf-theme:not([data-host-view="dashboard"]) .m-history-btn {
    display: none;
  }

  /* 活动条：顶栏下面一条细带（同一个 _campaign_banner.html） */
  body.nf-theme .m-shell .campaign-banner-inline.cb2 {
    display: flex;
    align-items: center;
    gap: 10px;
    width: auto;
    height: 38px;
    margin: 0;
    padding: 0 8px 0 14px;
    border: 0;
    border-bottom: 1px solid rgba(245, 181, 74, 0.18);
    border-radius: 0;
    background: linear-gradient(90deg, rgba(245, 181, 74, 0.12), rgba(245, 181, 74, 0.03) 75%);
    font-size: 13px;
    max-width: none;
  }

  body.nf-theme .m-shell .cb2 .cb2-name {
    flex: 1 1 auto;
  }

  body.nf-theme .m-shell .cb2 .cb2-meta,
  body.nf-theme .m-shell .cb2 .cb2-ghost {
    display: none;
  }

  body.nf-theme .m-shell .cb2 .cb2-cta {
    flex: none;
    height: 26px;
    padding: 0 12px;
    font-size: 12px;
  }

  body.nf-theme[data-host-view="canvas"] .m-shell {
    display: none;
  }

  /* 菜单抽屉 */
  body.nf-theme .m-scrim,
  body.nf-theme .m-scrim[hidden] {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 94;
    background: rgba(0, 0, 0, 0.56);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  body.nf-theme .m-scrim.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  body.nf-theme .m-drawer {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 95;
    width: min(86vw, 340px);
    padding-top: env(safe-area-inset-top);
    border-right: 1px solid var(--m-line);
    background: #0d0d10;
    box-shadow: 24px 0 60px rgba(0, 0, 0, 0.5);
    transform: translateX(-104%);
    visibility: hidden;
    transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 0.24s;
  }

  body.nf-theme .m-drawer.is-open {
    transform: none;
    visibility: visible;
    transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  html.m-drawer-open,
  html.m-drawer-open body {
    overflow: hidden;
  }

  body.nf-theme .m-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: none;
    height: var(--m-top-h);
    padding: 0 12px 0 18px;
  }

  body.nf-theme .m-drawer-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 2px 12px calc(20px + env(safe-area-inset-bottom));
  }

  body.nf-theme .m-account {
    padding: 14px;
    border: 1px solid var(--m-line);
    border-radius: var(--m-radius);
    background: var(--m-card);
  }

  body.nf-theme .m-account-who {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
  }

  body.nf-theme .m-avatar {
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
  }

  body.nf-theme .m-account-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
  }

  body.nf-theme .m-account-text strong,
  body.nf-theme .m-account-text small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.nf-theme .m-account-text strong {
    color: var(--m-ink);
    font-size: 15px;
    font-weight: 600;
  }

  body.nf-theme .m-account-text small {
    color: var(--m-muted);
    font-size: 12px;
  }

  body.nf-theme .m-account-wallet {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin: 14px 0 12px;
  }

  body.nf-theme .m-account-wallet > div {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
  }

  body.nf-theme .m-account-wallet span {
    color: var(--m-muted);
    font-size: 11.5px;
    white-space: nowrap;
  }

  body.nf-theme .m-account-wallet strong {
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--m-ink);
    font-size: 16px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  body.nf-theme .m-account-wallet strong.is-gift {
    color: var(--m-gift);
  }

  body.nf-theme .m-account-wallet strong.is-credit {
    color: var(--m-blue-ink);
  }

  body.nf-theme .m-account-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  body.nf-theme .m-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 40px;
    padding: 0 14px;
    border: 1px solid var(--m-line-2);
    border-radius: 11px;
    background: var(--m-card-2);
    color: var(--m-ink);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
  }

  body.nf-theme .m-btn-primary {
    border-color: transparent;
    background: var(--m-blue);
    color: #fff;
  }

  /* 抽屉里的活动卡片（同一个 _campaign_banner.html） */
  body.nf-theme .m-drawer .campaign-banner-inline.cb2 {
    flex-wrap: wrap;
    height: auto;
    max-width: none;
    margin: 10px 0 0;
    padding: 12px;
    border-radius: var(--m-radius);
    row-gap: 10px;
  }

  body.nf-theme .m-drawer .cb2 .cb2-name {
    flex: 1 1 auto;
  }

  body.nf-theme .m-drawer .cb2 .cb2-meta {
    order: 3;
    flex-basis: 100%;
    padding-left: 0;
    border-left: 0;
  }

  body.nf-theme .m-drawer .cb2 .cb2-ghost {
    order: 4;
  }

  body.nf-theme .m-drawer .cb2 .cb2-cta {
    order: 5;
    flex: 1 1 auto;
    height: 36px;
    font-size: 14px;
  }

  body.nf-theme .m-nav-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--m-line);
  }

  body.nf-theme .m-nav-group:first-of-type {
    border-top: 0;
  }

  body.nf-theme .m-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 46px;
    padding: 0 12px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--m-ink-2);
    font: inherit;
    font-size: 15px;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
  }

  body.nf-theme .m-nav-item:active {
    background: rgba(255, 255, 255, 0.05);
  }

  body.nf-theme .m-nav-item svg {
    flex: none;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    color: var(--m-muted);
  }

  body.nf-theme .m-nav-item.is-active {
    background: rgba(37, 99, 235, 0.14);
    color: #fff;
  }

  body.nf-theme .m-nav-item.is-active svg {
    color: var(--m-blue-ink);
  }

  body.nf-theme .m-nav-item.is-danger,
  body.nf-theme .m-nav-item.is-danger svg {
    color: #f58c8c;
  }

  body.nf-theme .m-count,
  body.nf-theme .m-lang-current {
    margin-left: auto;
    font-style: normal;
  }

  body.nf-theme .m-count {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 20px;
    text-align: center;
  }

  body.nf-theme .m-lang-current {
    color: var(--m-muted);
    font-size: 13px;
  }

  body.nf-theme .m-lang-options:not([hidden]) {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 4px 0 8px 44px;
  }

  body.nf-theme .m-lang-options button {
    height: 36px;
    border: 1px solid var(--m-line-2);
    border-radius: 10px;
    background: var(--m-card);
    color: var(--m-ink-2);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
  }

  body.nf-theme .m-lang-options button.is-active {
    border-color: rgba(37, 99, 235, 0.6);
    background: rgba(37, 99, 235, 0.16);
    color: #fff;
  }

  /* 旧的手机顶栏 / 菜单：被上面这一套取代 */
  body.nf-shell.nf-theme .topbar.topbar-user-nav,
  body.nf-theme.dashboard-page .dashboard-preview-root > .dashboard-preview-topbar,
  body.nf-theme.dashboard-page .dashboard-preview-root > .rightbar {
    display: none !important;
  }

  /* ── 2. 宿主页：顶栏在上（文档流里），下面整块给生成区 / 工作台 / 次要页面 iframe ── */
  body.nf-theme.dashboard-page {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  body.nf-theme.dashboard-page > .page.app-page.dashboard-page {
    flex: 1 1 auto;
    min-height: 0 !important;
    height: auto;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root {
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    row-gap: 0;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root > .main {
    grid-row: 1;
  }

  body.nf-theme[data-host-view="studio"] #app.nf-host-view,
  body.nf-theme[data-host-view="frame"] #nf-host-frame.nf-host-view {
    min-height: 0;
    height: 100%;
  }

  /* ── 3. 对话记录抽屉（.sidebar，从右侧滑出） ── */
  body.nf-theme.dashboard-page .dashboard-preview-root .sidebar {
    left: auto;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(88vw, 360px);
    padding: calc(8px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom));
    border: 0;
    border-left: 1px solid var(--m-line);
    border-radius: 0;
    background: #0d0d10;
    box-shadow: -24px 0 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    transform: translateX(104%);
    visibility: hidden;
    transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 0.24s;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .sidebar.mobile-open {
    transform: none;
    visibility: visible;
    transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .sidebar > * {
    flex: none;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 44px;
    margin: 0;
    padding: 0;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .sidebar-title.m-only {
    display: block;
    color: var(--m-ink);
    font-size: 16px;
    font-weight: 600;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .conversation-sidebar-close {
    width: 40px;
    height: 40px;
    border: 1px solid var(--m-line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .conversation-sidebar-close svg {
    width: 18px;
    height: 18px;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .sidebar .new-chat {
    width: 100%;
    height: 44px;
    border-radius: 12px;
    font-size: 15px;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .sidebar .search-box {
    height: 42px;
    min-height: 0;
    padding: 0 12px;
    border-radius: 12px;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .sidebar .search-box .conversation-search-input {
    font-size: 15px;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .sidebar > .conversation-list {
    flex: 1 1 auto;
    min-height: 0;
    margin: 0 -6px;
    padding: 0 6px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  body.nf-theme.dashboard-page .mobile-overlay {
    z-index: 75;
  }

  /* ── 4. 生成页：任务流 ── */
  /* .chat-panel 是绝对定位铺满 .main 的（inset: 0），左右留白只能靠收进来，不能靠父级 padding */
  body.nf-theme.dashboard-page .dashboard-preview-root .chat-panel {
    inset: 0 12px;
    width: auto;
    padding-top: 6px;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .turn {
    padding: 14px 0 18px;
  }

  /* 用户这一侧：右对齐的气泡，不要头像 / 「You · 时间」那一行 */
  body.nf-theme.dashboard-page .dashboard-preview-root .message-row.user .avatar,
  body.nf-theme.dashboard-page .dashboard-preview-root .message-row.user .message-meta,
  body.nf-theme.dashboard-page .dashboard-preview-root .message-row.assistant .avatar {
    display: none;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .message-row.user .message-col,
  body.nf-theme.dashboard-page .dashboard-preview-root .message-row.assistant .message-col {
    width: 100%;
    max-width: 100%;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .message-row.user .message-col {
    align-items: flex-end;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .message-row.user .bubble {
    max-width: 86%;
    padding: 10px 14px;
    border-radius: 18px 18px 6px 18px;
    font-size: 15px;
    line-height: 1.55;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .user-prompt-actions {
    margin-top: 4px;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .prompt-copy-btn {
    height: 28px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 12px;
  }

  /* 助手这一侧：一行「模型 · 状态 · 参数」，时间 / 用时放到卡片底部那行 */
  body.nf-theme.dashboard-page .dashboard-preview-root .assistant-meta {
    gap: 8px;
    margin-bottom: 8px;
    padding: 0 2px;
    font-size: 12px;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .assistant-meta .model-name {
    max-width: 52vw;
    font-size: 13px;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .assistant-meta :is(.assistant-time, .assistant-dur, .assistant-image-count) {
    display: none;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .status-badge,
  body.nf-theme.dashboard-page .dashboard-preview-root .assistant-meta .status-badge {
    height: 22px;
    padding: 0 8px;
    font-size: 11px;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .assistant-card {
    padding: 8px;
    border-radius: 16px;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .assistant-card .notice.error {
    font-size: 14px;
    line-height: 1.55;
  }

  /* 多张结果：两列网格（一列一张太长）；单张：整宽 */
  body.nf-theme.dashboard-page .dashboard-preview-root .result-grid.count-2,
  body.nf-theme.dashboard-page .dashboard-preview-root .result-grid.count-3,
  body.nf-theme.dashboard-page .dashboard-preview-root .result-grid.count-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .result-grid.count-1 .result-item {
    max-height: min(62vh, 520px);
  }

  body.nf-theme.dashboard-page .dashboard-preview-root :is(.result-grid.count-2, .result-grid.count-3, .result-grid.count-4) :is(.result-item, .loading-item) {
    max-height: none;
  }

  /* 图片下面一条操作栏（不再压在图上：两列时图太窄放不下五颗按钮） */
  body.nf-theme.dashboard-page .dashboard-preview-root .result-unit {
    flex-direction: column;
    gap: 4px;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .result-unit .image-actions {
    position: static;
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 2px;
    max-width: none;
    padding: 0 2px;
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .result-unit .image-actions .image-action-btn {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    max-width: 44px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    box-shadow: none;
    color: var(--m-ink-2);
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .result-unit .image-actions .image-action-btn:active {
    background: rgba(255, 255, 255, 0.08);
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .result-unit .image-actions .image-action-btn.download {
    color: var(--m-blue-ink);
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .result-unit .image-actions .image-action-btn.danger {
    color: #f58c8c;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .result-unit .image-actions .iab-icon svg {
    width: 18px;
    height: 18px;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .assistant-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 0 4px 2px;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .foot-meta {
    gap: 10px;
    color: var(--m-muted);
    font-size: 12px;
  }

  /* 失败 / 过期的任务：四个操作排成一行小按钮（原来是四个整宽大按钮摞起来） */
  body.nf-theme.dashboard-page .dashboard-preview-root .task-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .task-card-actions .task-card-action {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    height: 34px;
    padding: 0 8px;
    border-radius: 10px;
    font-size: 13px;
  }

  /* ── 5. 生成页：输入栏 ── */
  /* 输入栏背后的底色带：与桌面同一条规则（novart-flow-theme.css），手机上输入栏离底边 10px + 安全区 */
  body.nf-theme.dashboard-page .dashboard-preview-root .main::after {
    height: calc(var(--dashboard-composer-height, 160px) / 2 + 10px + env(safe-area-inset-bottom));
    background: var(--nf-bg, #08080b);
    pointer-events: none;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer {
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    width: auto;
    padding: 0;
    transform: none;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root :is(.composer-panel, .composer-input-area, .prompt-input-wrap, .composer-toolbar) {
    align-self: stretch;
    width: auto;
    min-width: 0;
    max-width: 100%;
  }

  /* 图片 / 视频 / 音频：带文字的分段按钮 */
  body.nf-theme.dashboard-page .dashboard-preview-root .mode-switch {
    align-self: flex-start;
    display: inline-flex;
    flex-direction: row;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--m-line-2);
    border-radius: 12px;
    background: rgba(20, 20, 23, 0.94);
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: auto;
    height: 32px;
    padding: 0 12px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--m-muted);
    font-size: 13px;
    font-weight: 500;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .mode-btn > span {
    display: inline;
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: nowrap;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .mode-btn svg {
    width: 16px;
    height: 16px;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .mode-btn.active {
    background: var(--m-blue);
    color: #fff;
    box-shadow: none;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer-panel {
    padding: 10px 10px 8px;
    border: 1px solid var(--m-line-2);
    border-radius: 18px;
    background: #141417;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.45);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  /* 没有参考素材时整行收起（「从素材库选」挪进了下面的工具条，见 app-dashboard.js） */
  body.nf-theme.dashboard-page .dashboard-preview-root .reference-strip:not(:has(.prompt-attachment-item)) {
    display: none;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .prompt-input-wrap {
    min-height: 0;
    padding: 2px 4px 0;
    border: 0;
    background: transparent;
  }

  /* 16px：iOS 上输入框字号小于 16px 会在聚焦时整页放大 */
  body.nf-theme.dashboard-page .dashboard-preview-root .prompt-textarea,
  body.nf-theme.dashboard-page .dashboard-preview-root .prompt-input-wrap .prompt-highlight {
    font-size: 16px;
    line-height: 1.5;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .prompt-textarea {
    min-height: 48px;
    max-height: 168px;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer-toolbar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
  }

  /* 参数一行：放不下就横向滑动（右边的发送按钮带一道同底色的阴影，盖住滑出去的那一截，提示还有）。
     不能用 mask-image：遮罩会连底部弹出的参数面板一起裁掉 */
  body.nf-theme.dashboard-page .dashboard-preview-root .composer-tools {
    flex: 1 1 auto;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    padding-right: 14px;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer-tools::-webkit-scrollbar {
    display: none;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer-tools > .composer-tool {
    flex: none;
    width: 34px;
    height: 34px;
    border: 1px solid var(--m-line-2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--m-ink-2);
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer-tools > .composer-tool[hidden] {
    display: none;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer-tools > .composer-tool svg {
    width: 17px;
    height: 17px;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer-chip {
    flex: none;
    min-width: 0;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer-chip[hidden] {
    display: none;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer-chip .mobile-picker-trigger {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 34px;
    max-width: 150px;
    padding: 0 10px;
    border: 1px solid var(--m-line-2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--m-ink);
    font-size: 13px;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer-chip .mobile-picker-trigger svg {
    position: static;
    flex: none;
    width: 12px;
    height: 12px;
    transform: none;
    color: var(--m-muted);
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer-chip.is-open .mobile-picker-trigger {
    border-color: rgba(37, 99, 235, 0.7);
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer-chip.is-open .mobile-picker-trigger svg {
    transform: rotate(180deg);
  }

  /* 参数名用触发按钮自己那一份（.mobile-picker-trigger-label），原来那颗 .chip-label 收起 */
  body.nf-theme.dashboard-page .dashboard-preview-root .composer-chip > .chip-label {
    display: none;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer-chip .mobile-picker-trigger-label {
    color: var(--m-muted);
    font-size: 12px;
    font-weight: 400;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer-chip .mobile-picker-trigger-value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
  }

  /* 模型 / 分辨率 / 比例 / 数量 / 时长的值本身就能看懂，省掉前面的字 */
  body.nf-theme.dashboard-page .dashboard-preview-root .composer-chip:is([data-chip="model"], [data-chip="resolution"], [data-chip="aspect"], [data-chip="count"], [data-chip="duration"]) .mobile-picker-trigger-label {
    display: none;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer-chip[data-chip="count"] .mobile-picker-trigger-value::before {
    content: "×";
    margin-right: 1px;
    color: var(--m-muted);
    font-weight: 400;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer-actions {
    flex: none;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #141417;
    box-shadow: -14px 0 12px 2px #141417;
  }

  /* 价格：放到分段按钮那一行的右边（.composer 是定位容器） */
  body.nf-theme.dashboard-page .dashboard-preview-root .composer-actions .composer-price:not([hidden]) {
    display: block;
    position: absolute;
    top: 9px;
    right: 4px;
    max-width: calc(100% - 250px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--m-muted);
    font-size: 12px;
    font-weight: 500;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer-actions .composer-price:empty {
    display: none;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root :is(.composer-form, .composer-row, .composer-panel, .composer-input-area, .composer-toolbar, .composer-actions) {
    position: static;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .generate-btn {
    flex: none;
    width: 44px;
    min-width: 44px;
    height: 40px;
    padding: 0;
    border-radius: 12px;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .generate-btn svg {
    width: 19px;
    height: 19px;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer .notice {
    font-size: 13px;
  }

  /* 参数选择：底部弹出面板（遮罩由 app-dashboard.js 插进 .composer，打开时 .composer 提到最上层） */
  body.m-sheet-open.nf-theme.dashboard-page .dashboard-preview-root .composer {
    z-index: 130;
  }

  /* .composer-form 平时带 z-index（flex 子项因此自成层叠上下文），面板会被关在里面、盖不过遮罩：打开时去掉 */
  body.m-sheet-open.nf-theme.dashboard-page .dashboard-preview-root .composer-form {
    z-index: auto;
  }

  body.nf-theme.dashboard-page .m-sheet-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1;
    background: rgba(0, 0, 0, 0.56);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
  }

  body.nf-theme.dashboard-page .m-sheet-scrim.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer-chip .mobile-picker-panel,
  body.nf-theme.dashboard-page .dashboard-preview-root .composer-chip .mobile-picker-panel.has-groups {
    position: fixed;
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: auto;
    min-width: 0;
    max-width: none;
    max-height: min(72dvh, 600px);
    margin: 0;
    padding: 6px 12px calc(14px + env(safe-area-inset-bottom));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--m-line-2);
    border-bottom: 0;
    border-radius: 20px 20px 0 0;
    background: #121215;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
    backdrop-filter: none;
    transform: none;
    animation: m-sheet-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer-chip .mobile-picker-panel[hidden] {
    display: none;
  }

  /* 面板标题（取自参数名，app-dashboard.js 写进 data-title）+ 顶部的小横条 */
  body.nf-theme.dashboard-page .dashboard-preview-root .composer-chip .mobile-picker-panel::before {
    content: attr(data-title);
    position: sticky;
    top: -6px;
    z-index: 1;
    flex: none;
    margin: -6px -12px 4px;
    padding: 22px 18px 10px;
    border-bottom: 1px solid var(--m-line);
    background: #121215 linear-gradient(rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.22)) center 8px / 36px 4px no-repeat;
    color: var(--m-ink);
    font-size: 15px;
    font-weight: 600;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer-chip .mobile-picker-option {
    flex: none;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 12px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    white-space: normal;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer-chip .mobile-picker-option.is-active {
    background: rgba(37, 99, 235, 0.16);
    box-shadow: none;
    color: #fff;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer-chip .mobile-picker-option-name {
    flex: 1 1 auto;
    min-width: 0;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer-chip .mobile-picker-section-title {
    padding: 10px 12px 4px;
    color: var(--m-muted);
    font-size: 12px;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer-chip .mobile-picker-group {
    flex: none;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer-chip .mobile-picker-group-caret {
    width: 16px;
    height: 16px;
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer-chip .mobile-picker-group.is-open > .mobile-picker-group-trigger .mobile-picker-group-caret {
    transform: rotate(90deg);
  }

  body.nf-theme.dashboard-page .dashboard-preview-root .composer-chip .mobile-picker-submenu {
    position: static;
    width: auto;
    min-width: 0;
    margin: 2px 0 6px 14px;
    padding: 2px 0 2px 10px;
    border: 0;
    border-left: 1px solid var(--m-line-2);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  @keyframes m-sheet-in {
    from { transform: translateY(24px); opacity: 0; }
  }

  /* ── 6. 次要页面（设置 / 通知 / 模型价格 / 开发者 / API 结果 / 推广 / 抽奖）──
     这些页面平时在宿主页的 iframe 里：电脑上 iframe 扣掉侧栏也可能窄于 900px（1024 宽的窗口只剩 ~800），
     所以本节和第 7 节的规则一律带 :is(html:not(.nf-in-frame), html.nf-host-mobile) ——整页打开时照常按媒体查询，
     在 iframe 里则只有宿主页本身是手机宽度（base.html 给 iframe 的 <html> 挂 nf-host-mobile）才生效。 */
  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme .pg {
    padding: 16px 14px 40px;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme .pg .pg-head {
    gap: 12px;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme .pg .pg-title {
    font-size: 24px;
  }

  /* 表单控件：整宽，16px 字（iOS 聚焦不放大） */
  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme .pg :is(input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], input[type="url"], input:not([type]), select, textarea),
  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme .settings-shell :is(input[type="text"], input[type="email"], input[type="password"], input[type="number"], input:not([type]), select, textarea) {
    max-width: 100%;
    font-size: 16px;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme .pg .pg-field[style*="max-width"] {
    max-width: none !important;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme .pg .pg-field :is(input, select, textarea),
  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme .pg .pg-form :is(input[type="password"], input[type="text"], input[type="email"]) {
    width: 100%;
  }

  /* 页签 / 分节导航：一行横滑 */
  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme .pg .pg-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme .pg .pg-tabs::-webkit-scrollbar {
    display: none;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme .pg .pg-tab {
    flex: none;
  }

  /* 表格：一行一张卡片，单元格前面是列名（data-label 由 app-shell.js 从表头抄过来） */
  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme :is(.pg-table-wrap, .settings-shell div[style*="overflow-x"]) {
    overflow: visible !important;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table:is(.pg-table, .ledger-table):not(.developer-api-key-table) {
    display: block;
    width: 100%;
    min-width: 0 !important;
    border: 0;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table:is(.pg-table, .ledger-table):not(.developer-api-key-table) > thead {
    display: none;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table:is(.pg-table, .ledger-table):not(.developer-api-key-table) > tbody {
    display: block;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table:is(.pg-table, .ledger-table):not(.developer-api-key-table) > tbody > tr {
    display: block;
    padding: 12px 14px;
    border-bottom: 1px solid var(--m-line);
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table:is(.pg-table, .ledger-table):not(.developer-api-key-table) > tbody > tr:last-child {
    border-bottom: 0;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table:is(.pg-table, .ledger-table):not(.developer-api-key-table) > tbody > tr > td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    max-width: none !important;
    min-width: 0;
    padding: 3px 0;
    border: 0;
    background: transparent;
    font-size: 14px;
    text-align: right;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table:is(.pg-table, .ledger-table):not(.developer-api-key-table) > tbody > tr > td::before {
    content: attr(data-label);
    flex: none;
    max-width: 45%;
    color: var(--m-muted);
    font-size: 12.5px;
    text-align: left;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table:is(.pg-table, .ledger-table):not(.developer-api-key-table) > tbody > tr > td:is([data-label=""], :not([data-label]))::before {
    display: none;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table:is(.pg-table, .ledger-table):not(.developer-api-key-table) > tbody > tr > td > :is(span, code, div) {
    min-width: 0;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table:is(.pg-table, .ledger-table):not(.developer-api-key-table) > tbody > tr > td.pg-actions-cell {
    justify-content: flex-end;
    width: auto;
    padding-top: 8px;
  }

  /* 只有一个单元格的行（空状态 / 分组标题）照常整行 */
  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table:is(.pg-table, .ledger-table) > tbody > tr > td:only-child {
    display: block;
    text-align: center;
  }

  /* 账单流水：类型 + 金额一行，说明一行，时间一行 */
  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table.ledger-table.pg-table > tbody > tr:has(> td:nth-child(4)) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "type amount" "desc desc" "time time";
    gap: 4px 12px;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table.ledger-table.pg-table > tbody > tr > td::before {
    display: none;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table.ledger-table.pg-table > tbody > tr > td:nth-child(1) {
    grid-area: time;
    color: var(--m-muted);
    font-size: 12px;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table.ledger-table.pg-table > tbody > tr > td:nth-child(2) {
    grid-area: type;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table.ledger-table.pg-table > tbody > tr > td:nth-child(3) {
    grid-area: desc;
    color: var(--m-ink-2);
    text-align: left;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table.ledger-table.pg-table > tbody > tr > td:nth-child(4) {
    grid-area: amount;
    font-size: 15px;
    font-weight: 600;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table.ledger-table.pg-table > tbody > tr > td {
    justify-content: flex-start;
    text-align: left;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table.ledger-table.pg-table > tbody > tr > td:nth-child(4) {
    justify-content: flex-end;
  }

  /* API 结果：任务号 + 状态一行，提示词，其余参数 */
  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table.api-result-table.pg-table > tbody > tr > td:first-child {
    display: block;
    text-align: left;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table.api-result-table.pg-table > tbody > tr > td:first-child::before {
    display: none;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table.api-result-table.pg-table > tbody > tr > td:first-child .pg-cell-sub {
    display: inline;
    margin-left: 8px;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table.api-result-table.pg-table > tbody > tr > td span[title] {
    white-space: normal !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-align: right;
  }

  /* 模型价格：一张模型一张卡片——名字 + 状态在上，价格三格并排 */
  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table.pgm-table.pg-table > tbody > tr:not(.pgm-group-row):not(.pgm-sub-row) {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 10px;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table.pgm-table.pg-table > tbody > tr > td {
    display: block;
    padding: 0;
    text-align: left;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table.pgm-table.pg-table > tbody > tr > td::before {
    display: block;
    max-width: none;
    margin-bottom: 3px;
    font-size: 11.5px;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table.pgm-table.pg-table > tbody > tr > td.pgm-model {
    grid-column: 1 / 3;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table.pgm-table.pg-table > tbody > tr > td.pgm-model::before,
  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table.pgm-table.pg-table > tbody > tr > td:nth-child(2)::before {
    display: none;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table.pgm-table.pg-table > tbody > tr > td.pgm-model strong {
    display: block;
    font-size: 15px;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table.pgm-table.pg-table > tbody > tr > td.pgm-model code {
    display: inline-block;
    margin-top: 4px;
    font-size: 11.5px;
    word-break: break-all;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table.pgm-table.pg-table > tbody > tr > td:nth-child(2) {
    grid-column: 3;
    justify-self: end;
    align-self: start;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table.pgm-table.pg-table > tbody > tr > td.pgm-lines {
    grid-column: 1 / -1;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table.pgm-table.pg-table > tbody > tr > td.pg-num {
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.035);
    font-size: 14px;
    font-weight: 600;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table.pgm-table.pg-table > tbody > tr:is(.pgm-group-row, .pgm-sub-row) {
    display: block;
    padding: 12px 14px 4px;
    border-bottom: 0;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme table.pgm-table.pg-table > tbody > tr:is(.pgm-group-row, .pgm-sub-row) > th {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    border: 0;
    text-align: left;
  }

  /* 推广 / 抽奖页（旧版 .settings-shell 页头）：标题整宽，「返回工作台」收起——手机上有菜单 */
  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme .settings-shell .settings-page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme .settings-shell .settings-page-head > .button.secondary[href="/app"] {
    display: none;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme .settings-shell {
    padding-left: 14px;
    padding-right: 14px;
  }

  /* ── 7. 弹窗：盖过手机顶栏（60）和菜单抽屉（95）。原来有的只有 40 / 50 / 70，顶栏会压住弹窗的标题栏 ── */
  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme :is(.top-up-modal, .referral-modal, .announcement-modal, .support-modal, .app-modal, .model-catalog-modal, .asset-modal) {
    z-index: 1200;
  }

  /* 新站内信提示：顶栏下面一张整宽卡片，关闭收成右上角的 ×（原来「关闭」是卡片右边的一颗独立按钮，压在活动条上） */
  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme .notification-toast {
    top: calc(var(--m-top-h) + env(safe-area-inset-top) + 8px);
    left: 10px;
    right: 10px;
    width: auto;
    z-index: 90;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme .notification-toast-card {
    gap: 6px;
    padding: 12px 46px 12px 14px;
    background: rgba(24, 24, 27, 0.97);
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme .notification-toast-title {
    font-size: 15px;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme .notification-toast-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: transparent;
    font-size: 0;
  }

  :is(html:not(.nf-in-frame), html.nf-host-mobile) body.nf-theme .notification-toast-close::before {
    content: "×";
    color: var(--m-muted);
    font-size: 22px;
    line-height: 32px;
  }

  /* ── 9. 官网首页与登录弹窗：表单整宽（原来右边留了 68px 给关闭键，输入框只有对话框的七成宽）── */
  body.nf-theme .landing-login-dialog {
    width: calc(100% - 24px);
    padding: 18px 18px 22px;
  }

  body.nf-theme .landing-login-dialog .landing-auth-switch {
    margin-right: 52px;
  }

  body.nf-theme .landing-login-dialog :is(.landing-auth-panel, .landing-login-form, .landing-login-form label, .landing-login-form input:not([type="checkbox"]), .landing-login-form button[type="submit"]) {
    width: 100%;
    max-width: none;
  }

  body.nf-theme .landing-login-dialog input:not([type="checkbox"]) {
    font-size: 16px;
  }

  /* 平板竖屏（600–900px）：任务流和输入栏收在 760px 宽的一列里居中，不铺满整块屏 */
  @media (min-width: 600px) {
    body.nf-theme.dashboard-page .dashboard-preview-root .chat-panel {
      max-width: 760px;
      margin: 0 auto;
    }

    body.nf-theme.dashboard-page .dashboard-preview-root .composer {
      left: max(10px, calc(50% - 380px));
      right: max(10px, calc(50% - 380px));
    }
  }

  @media (max-width: 360px) {
    body.nf-theme .m-wallet-label {
      display: none;
    }
  }
}
