header[data-testid="stHeader"], div[data-testid="stToolbar"], div[data-testid="stDecoration"], div[data-testid="stStatusWidget"], div[data-testid="stSkillsNudgeAnchor"], div[data-testid="stSkillsNudge"] { display: none !important; } div[data-testid="stMainBlockContainer"] { padding-top: 0.5rem !important; } h1 { padding-top: 0 !important; margin-top: 0 !important; } /* Streamlit 默认让标签中的帮助区域占据剩余宽度,导致问号按钮贴到控件最右侧。 帮助提示在语义上从属于标签文字,因此取消该区域的伸展,并用固定小间距让 问号紧跟标签;没有 help 参数的标签不存在这个 div,不会受到影响。 */ label[data-testid="stWidgetLabel"] > div { flex: 0 0 auto !important; width: auto !important; margin-left: 0.35rem !important; } /* 配音方式位于四列布局中的窄面板。Streamlit 的 stretch 模式默认让单个分段 按钮接近半行宽,三个选项会换成两行;这里仅对该控件改为三等分,并压缩 水平内边距,保持其它 segmented control 的原生尺寸不变。 */ div[class*="st-key-voice_mode_control"] [role="radiogroup"] { flex-wrap: nowrap !important; } div[class*="st-key-voice_mode_control"] [role="radiogroup"] > button { flex: 1 1 0 !important; width: auto !important; min-width: 0 !important; padding: 0.25rem !important; } div[class*="st-key-voice_mode_control"] [role="radiogroup"] > button p { overflow: hidden !important; font-size: 0.8rem !important; text-overflow: ellipsis !important; white-space: nowrap !important; } /* 顶部品牌区将项目名和弱化版本号放在同一基线。项目名称仍是页面唯一的 h1; 版本号本身作为项目链接,避免增加独立图标而干扰标题的视觉层级。 */ .mpt-brand { min-width: 0; margin: 0; padding: 0; color: inherit; line-height: 1.15; } /* Streamlit 会在自定义 h1 内增加一层文本容器,实际的行内布局需要作用在 这层容器上,才能稳定控制项目名和版本号的间距。 */ .mpt-brand > span:first-child { display: flex; align-items: baseline; gap: 0.65rem; min-width: 0; } .mpt-brand__name { min-width: 0; font-size: 2.75rem; font-weight: 700; letter-spacing: 0; white-space: nowrap; } .mpt-brand__version { flex: 0 0 auto; font-size: 1rem; font-weight: 600; color: inherit !important; opacity: 0.72; text-decoration: none !important; white-space: nowrap; } .mpt-brand__version:hover { color: inherit !important; opacity: 1; text-decoration: underline !important; text-underline-offset: 0.18em; } .mpt-brand__version:focus-visible { outline: 2px solid rgba(255, 75, 75, 0.48); outline-offset: 2px; } /* Streamlit 会自动给 h1 追加一个标题锚点。品牌区已有版本号项目链接,额外的 标题锚点没有实际价值,因此只在这个标题内隐藏,避免窄屏出现多余图标。 */ .mpt-brand > [data-testid="stHeaderActionElements"] { display: none !important; } /* 顶部任务入口由 st.fragment 定时刷新,Streamlit 会为 Fragment 自动生成一个 占满整行的 LayoutWrapper。这里只收缩该包装层,保证右侧操作区按内容紧凑排列。 */ .st-key-top_bar_actions > div[data-testid="stLayoutWrapper"]:first-child { flex: 0 0 auto !important; width: fit-content !important; } @media (max-width: 700px) { .mpt-brand > span:first-child { gap: 0.45rem; } .mpt-brand__name { font-size: 1.875rem; } .mpt-brand__version { font-size: 0.875rem; } } @media (max-width: 480px) { .mpt-brand > span:first-child { gap: 0.35rem; } .mpt-brand__name { font-size: 1.5rem; } .mpt-brand__version { font-size: 0.75rem; } } /* 高级设置属于内容展开入口,不是执行操作。保留 Streamlit 原生 expander 的 语义和键盘交互,只在带 advanced_settings_ key 的局部容器内移除卡片边框, 避免与紧邻的 AI 生成按钮形成两个连续大按钮的视觉干扰。 */ div[class*="st-key-advanced_settings_"] details { border: 0 !important; border-radius: 4px !important; background: transparent !important; } div[class*="st-key-advanced_settings_"] details > summary { min-height: 2.25rem !important; padding: 0.35rem 0.25rem !important; color: inherit !important; opacity: 0.78; } div[class*="st-key-advanced_settings_"] details > summary:hover { opacity: 1; background: color-mix( in srgb, currentColor 6%, transparent ) !important; } /* 展开后让标题和内容共享同一背景,视觉上形成连续区域;折叠状态仍保持原有的 透明轻量入口,不额外占用页面层级。 */ div[class*="st-key-advanced_settings_"] details[open] > summary { border-radius: 4px 4px 0 0 !important; opacity: 1; background: color-mix( in srgb, currentColor 5%, transparent ) !important; } div[class*="st-key-advanced_settings_"] details > summary:focus { background: color-mix( in srgb, currentColor 5%, transparent ) !important; box-shadow: none !important; outline: none !important; } /* 键盘操作使用标题下划线作为焦点反馈,不再绘制任何外框,确保展开区域在视觉 上完全无边框,同时仍能让键盘用户识别当前焦点。 */ div[class*="st-key-advanced_settings_"] details > summary:focus-visible { box-shadow: none !important; } div[class*="st-key-advanced_settings_"] details > summary:focus-visible p { text-decoration: underline !important; text-underline-offset: 0.18em; } div[class*="st-key-advanced_settings_"] details > summary p { font-size: 0.9rem !important; font-weight: 500 !important; } /* 内容区与展开标题无缝衔接,不使用任何边框,仅通过统一背景和内边距表达 控件从属于高级设置,避免出现嵌套卡片或割裂的两段式结构。 */ div[class*="st-key-advanced_settings_"] div[data-testid="stExpanderDetails"] { margin-top: 0 !important; padding: 0.75rem 0.75rem 0.85rem 1rem !important; border: 0 !important; border-radius: 0 0 4px 4px !important; background: color-mix( in srgb, currentColor 5%, transparent ) !important; } /* 任务管理 popover 需要固定宽度,避免内容从空状态、列表状态切换时 反复改变宽度造成页面抖动。宽度仍保留视口约束,兼容窄屏。 */ div[data-testid="stPopoverBody"] { width: min(860px, calc(100vw - 48px)) !important; max-width: min(860px, calc(100vw - 48px)) !important; } div[data-testid="stPopoverBody"] div[data-testid="stVerticalBlock"] { width: 100% !important; } /* 任务管理列表保留 Streamlit 原生布局,只做轻量压缩,避免每一行过高。 通过 task_row_ key 限定作用范围,避免影响其它配置面板的 container。 */ div[class*="st-key-task_row_"] { margin-bottom: 0.18rem !important; } div[class*="st-key-task_row_"] div[data-testid="stVerticalBlockBorderWrapper"] { padding: 0.18rem 0.6rem !important; } div[class*="st-key-task_row_"] div[data-testid="stElementContainer"], div[class*="st-key-task_row_"] div[data-testid="stMarkdown"] { margin-bottom: 0 !important; } div[class*="st-key-task_row_"] div[data-testid="stMarkdown"] { display: flex !important; align-items: center !important; min-height: 1.75rem !important; } div[class*="st-key-task_row_"] div[data-testid="stMarkdownContainer"] { display: flex !important; align-items: center !important; margin-bottom: 0 !important; } div[class*="st-key-task_row_"] p { margin-bottom: 0 !important; line-height: 1.25 !important; } div[class*="st-key-task_row_"] button[kind="secondary"] { position: relative !important; min-height: 1.75rem !important; height: 1.75rem !important; padding: 0.1rem 0.3rem !important; } /* 按钮文字视觉隐藏后,Streamlit 仍会保留图标与文字之间的默认间距,导致 单独图标向左偏移。清除该间距并让内容层占满按钮,确保操作图标严格居中。 */ div[class*="st-key-task_row_"] button[kind="secondary"] span[data-has-shortcut] { width: 100% !important; gap: 0 !important; justify-content: center !important; } /* 行内操作保留可访问的按钮名称,但视觉上只显示图标。使用屏幕阅读器可见的 隐藏方式,而不是 display:none,确保每个操作仍能被正确朗读。 */ div[class*="st-key-task_row_"] button[kind="secondary"] p { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; clip-path: inset(50%) !important; white-space: nowrap !important; } /* 中等宽度下将四个设置面板调整为 2×2,避免每列过窄导致标签和按钮频繁换行。 */ @media (min-width: 701px) and (max-width: 1100px) { .mpt-brand__name { font-size: 2.25rem; } .mpt-brand__version { font-size: 0.875rem; } div[class*="st-key-main_settings_grid"] > div[data-testid="stLayoutWrapper"] > div[data-testid="stHorizontalBlock"] { flex-wrap: wrap !important; gap: 1rem !important; } div[class*="st-key-main_settings_grid"] > div[data-testid="stLayoutWrapper"] > div[data-testid="stHorizontalBlock"] > div[data-testid="stColumn"] { flex: 1 1 calc(50% - 0.5rem) !important; width: calc(50% - 0.5rem) !important; min-width: calc(50% - 0.5rem) !important; } } /* 移动端隐藏桌面表头,并将任务行重排为“主题 + 元信息 + 操作”紧凑结构。 */ @media (max-width: 700px) { div[class*="st-key-task_table_header_"] { display: none !important; } div[class*="st-key-task_row_"] > div[data-testid="stLayoutWrapper"] > div[data-testid="stHorizontalBlock"] { display: grid !important; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 0.2rem 0.5rem !important; align-items: center !important; } div[class*="st-key-task_row_"] > div[data-testid="stLayoutWrapper"] > div[data-testid="stHorizontalBlock"] > div[data-testid="stColumn"] { width: auto !important; min-width: 0 !important; } div[class*="st-key-task_row_"] > div[data-testid="stLayoutWrapper"] > div[data-testid="stHorizontalBlock"] > div[data-testid="stColumn"]:nth-child(1) { grid-column: 1; grid-row: 2; } div[class*="st-key-task_row_"] > div[data-testid="stLayoutWrapper"] > div[data-testid="stHorizontalBlock"] > div[data-testid="stColumn"]:nth-child(2) { grid-column: 2; grid-row: 2; } div[class*="st-key-task_row_"] > div[data-testid="stLayoutWrapper"] > div[data-testid="stHorizontalBlock"] > div[data-testid="stColumn"]:nth-child(3) { grid-column: 1 / 4; grid-row: 1; font-weight: 600; } div[class*="st-key-task_row_"] > div[data-testid="stLayoutWrapper"] > div[data-testid="stHorizontalBlock"] > div[data-testid="stColumn"]:nth-child(4) { grid-column: 3; grid-row: 2; } div[class*="st-key-task_row_"] > div[data-testid="stLayoutWrapper"] > div[data-testid="stHorizontalBlock"] > div[data-testid="stColumn"]:nth-child(5) { grid-column: 4; grid-row: 1 / 3; } div[class*="st-key-task_row_"] > div[data-testid="stLayoutWrapper"] > div[data-testid="stHorizontalBlock"] > div[data-testid="stColumn"]:nth-child(5) div[data-testid="stHorizontalBlock"] { display: flex !important; flex-direction: row !important; gap: 0.15rem !important; } div[class*="st-key-task_row_"] > div[data-testid="stLayoutWrapper"] > div[data-testid="stHorizontalBlock"] > div[data-testid="stColumn"]:nth-child(5) div[data-testid="stColumn"] { flex: 1 1 0 !important; width: auto !important; min-width: 1.75rem !important; } }