:root { /* 默认深色主题,避免闪烁 */ --bg: #121315; --panel: #1a1a1a; --text: #e6e6e6; --muted: #9a9a9a; --primary: #ffffff; --primary-600: #e6e6e6; --danger: #ff5d5d; --success: #28c76f; --border: #2a2a2a; --card: #121212; --shadow: 0 10px 30px rgba(0,0,0,0.3); --radius: 4px; --ring: rgba(255,255,255,0.12); --active-text: #111111; --switch-knob: #ffffff; --switch-knob-checked: #1a1a1a; --placeholder: #b8c1d1; } * { box-sizing: border-box; } html, body { height: 100%; } html { scrollbar-gutter: stable both-edges; } /* 固定滚动条占位,避免切换/加载导致布局左右抖动 */ body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.7 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; /* 背景图片设置 - 电脑端 */ background-image: url('/image/windows7.jpg'); background-size: cover; background-position: center; background-repeat: no-repeat; background-attachment: fixed; position: relative; } /* 背景遮罩层,提升可读性 */ body::before { content: ''; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.4); z-index: -1; pointer-events: none; } /* 深色主题遮罩更深 */ [data-theme="dark"] body::before { background: rgba(0, 0, 0, 0.5); } /* 浅色主题遮罩更浅 */ [data-theme="light"] body::before { background: rgba(255, 255, 255, 0.6); } img { max-width: 100%; display: block; } .app-header { position: fixed; top: 0; left: 0; right: 0; width: 100%; z-index: 50; display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--panel); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); transition: background-color 0.2s ease, border-color 0.2s ease; } .brand { font-weight: 700; letter-spacing: 0.5px; font-size: 16px; color: var(--text); } .tabs { display: inline-flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; } /* 头部右侧操作区(主题/提示音) */ .header-actions { display: inline-flex; gap: 8px; flex-shrink: 0; } .tab-btn { appearance: none; background: transparent; color: var(--text); border: 1px solid var(--border); padding: 10px 14px; border-radius: var(--radius); white-space: nowrap; transition: none; cursor: pointer; font-weight: 700; } .tab-btn:hover { color: var(--text); border-color: var(--border); } .tab-btn.active { background: var(--primary); color: var(--active-text); border-color: transparent; box-shadow: none; } main { max-width: 1280px; margin: 24px auto; /* 预留固定头部高度,避免切换/滚动产生顶端位移 */ padding: 64px 20px 80px; } .tab { display: none; } .tab.active { display: block; } h2 { margin: 10px 0 14px; font-size: 18px; font-weight: 700; } .card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; } /* 汉堡菜单按钮(仅手机端显示) */ .menu-toggle { display: none; appearance: none; background: transparent; border: none; font-size: 24px; color: var(--text); cursor: pointer; padding: 8px; line-height: 1; } /* 侧边栏 */ .sidebar { position: fixed; top: 0; left: -280px; width: 280px; height: 100%; background: var(--panel); border-right: 1px solid var(--border); z-index: 1000; transition: left 0.3s ease; overflow-y: auto; display: flex; flex-direction: column; } .sidebar.active { left: 0; } .sidebar-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.5); z-index: 999; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; } .sidebar-overlay.active { opacity: 1; pointer-events: auto; } .sidebar-header { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-bottom: 1px solid var(--border); } .sidebar-close { appearance: none; background: transparent; border: none; font-size: 32px; color: var(--text); cursor: pointer; line-height: 1; padding: 0; width: 32px; height: 32px; } .sidebar-nav { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 8px; } .sidebar-nav .tab-btn { width: 100%; text-align: left; justify-content: flex-start; } .sidebar-actions { padding: 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; } .sidebar-actions .tab-btn { width: 100%; } /* Form grid - mobile first */ .form-grid { display: grid; grid-template-columns: 1fr; gap: 12px; } /* Larger screens */ @media (min-width: 640px) { .form-grid { grid-template-columns: repeat(2, 1fr); } } @media (min-width: 960px) { .form-grid { grid-template-columns: repeat(3, 1fr); } } @media (min-width: 1200px) { .form-grid { grid-template-columns: repeat(4, 1fr); } } label { display: grid; gap: 6px; color: var(--text); font-size: 14px; font-weight: 600; } label.full { grid-column: 1 / -1; } input[type="text"], input[type="password"], input[type="number"], textarea, select { width: 100%; padding: 12px 14px; background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); outline: none; transition: border-color .18s ease, box-shadow .18s ease; box-shadow: inset 0 1px 0 rgba(255,255,255,0.03); } textarea { min-height: 84px; resize: vertical; } input:focus, textarea:focus, select:focus { border-color: var(--primary-600); box-shadow: 0 0 0 3px var(--ring); } /* Switch */ .switch { display: flex; align-items: center; gap: 10px; } .switch input[type="checkbox"] { appearance: none; width: 44px; height: 26px; border-radius: 999px; background: #2a3040; position: relative; outline: none; border: 1px solid var(--border); transition: background .18s ease, border-color .18s ease; } .switch input[type="checkbox"]::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--switch-knob); transition: transform .18s ease, background .18s ease; } .switch input[type="checkbox"]:checked { background: var(--primary); border-color: transparent; } .switch input[type="checkbox"]:checked::after { transform: translateX(18px); background: var(--switch-knob-checked); } /* Actions */ .actions { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 4px; } button { appearance: none; border: 1px solid var(--border); background: #1a2030; color: #e8ecff; border-radius: var(--radius); padding: 12px 16px; font-weight: 800; font-size: 16px; letter-spacing: .2px; cursor: pointer; transition: background .18s ease, border-color .18s ease, box-shadow .2s ease, color .18s ease; } button:hover { border-color: #3a3a3a; background: #222222; } button:active { opacity: 0.94; } /* 可键盘操作的聚焦态 */ button:focus-visible, .tab-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); border-color: var(--primary-600); } button.primary { /* 使用主题主色:浅色=黑,深色=白 */ background: var(--primary); border-color: transparent; color: var(--active-text) !important; text-shadow: none; box-shadow: none; } button.primary:hover { filter: brightness(0.92); } /* Result */ .result { margin-top: 14px; display: grid; gap: 12px; } .result img { width: 100%; border-radius: var(--radius); border: 1px solid var(--border); background: #0e1118; } /* 图片操作按钮区域 */ .image-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; padding: 10px 0; } .save-btn { background: var(--primary); color: var(--active-text); border: none; padding: 12px 24px; font-size: 15px; font-weight: 700; border-radius: var(--radius); cursor: pointer; transition: all 0.2s ease; display: inline-flex; align-items: center; gap: 8px; } .save-btn:hover { filter: brightness(0.92); transform: translateY(-1px); } .save-btn:active { transform: translateY(0); } .saved-path { display: grid; grid-template-columns: 120px 1fr; gap: 10px; align-items: center; } .saved-path label { margin: 0; color: var(--muted); } .saved-path input { width: 100%; } /* Toast: 固定顶部,不占用底部空间 */ .toast { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); background: rgba(17, 23, 34, 0.96); color: #fff; border: 1px solid var(--border); padding: 8px 14px; border-radius: var(--radius); box-shadow: var(--shadow); z-index: 100; transition: none; max-width: 92%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; } .toast:empty { display: none; } .toast.success { border-color: rgba(40, 199, 111, .4); } .toast.error { border-color: rgba(255, 93, 93, .4); } /* Loading overlay */ .loading.hidden { display: none; } .loading { position: fixed; inset: 0; background: rgba(11,13,18,0.7); display: grid; place-items: center; z-index: 200; } .spinner { width: 46px; height: 46px; border-radius: 50%; border: 4px solid rgba(255,255,255,0.12); border-top-color: var(--primary-600); animation: spin 0.8s linear infinite; margin: 0 auto 8px; } .loading-text { color: var(--muted); font-weight: 600; text-align: center; } @keyframes spin { to { transform: rotate(360deg); } } /* Improve mobile tap targets */ input[type="file"] { padding: 10px; background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); } /* 自定义背景上传组件 */ .background-upload-wrapper { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .background-upload-wrapper input[type="file"] { flex: 1; min-width: 200px; } .background-upload-wrapper button { flex-shrink: 0; padding: 10px 16px; font-size: 14px; } /* HF 环境提示信息 */ .hf-notice { color: var(--muted); font-size: 13px; margin-top: 12px; padding: 10px 14px; background: var(--card); border: 1px dashed var(--border); border-radius: var(--radius); text-align: center; } /* 仅桌面端显示的元素 */ .desktop-only { display: flex; } /* ===== 模态框样式 ===== */ .modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; } .modal.hidden { display: none; } .modal-overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); } .modal-content { position: relative; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); max-width: 90%; max-height: 80vh; width: 600px; display: flex; flex-direction: column; overflow: hidden; } .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-bottom: 1px solid var(--border); } .modal-title { font-weight: 700; font-size: 18px; } .modal-close { appearance: none; background: transparent; border: none; font-size: 28px; color: var(--text); cursor: pointer; line-height: 1; padding: 0; width: 32px; height: 32px; } /* 目录浏览器 */ .dir-browser { width: 100%; max-width: 700px; } .dir-browser-path { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--border); } .dir-browser-path span { flex-shrink: 0; color: var(--muted); font-size: 14px; } .dir-browser-path input { flex: 1; background: var(--panel); font-size: 13px; padding: 8px 10px; } .dir-browser-actions { display: flex; gap: 8px; padding: 10px 16px; flex-wrap: wrap; border-bottom: 1px solid var(--border); } .dir-action-btn { padding: 8px 12px; font-size: 13px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: background 0.2s; } .dir-action-btn:hover { background: var(--border); } .dir-browser-list { flex: 1; overflow-y: auto; max-height: 300px; padding: 8px; } .dir-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius); cursor: pointer; transition: background 0.15s; } .dir-item:hover { background: var(--card); } .dir-item.selected { background: var(--primary); color: var(--active-text); } .dir-item-icon { font-size: 20px; } .dir-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .dir-item.inaccessible { opacity: 0.5; cursor: not-allowed; } .dir-browser-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px; border-top: 1px solid var(--border); } .dir-browser-empty { text-align: center; color: var(--muted); padding: 40px 20px; } /* ===== 主题变量与覆盖 ===== */ /* 深色为默认 */ :root, [data-theme="dark"] { /* 深色:去蓝化,统一深灰系 */ --bg: #121315; --panel: #1a1a1a; --text: #e6e6e6; --muted: #9a9a9a; /* 深色主按钮前景仍使用白色/黑色对比色 */ --primary: #ffffff; --primary-600: #e6e6e6; --danger: #ff5d5d; --success: #28c76f; --border: #2a2a2a; --card: #121212; --ring: rgba(255,255,255,0.12); --active-text: #111111; --switch-knob-checked: #1a1a1a; } /* 浅色主题 */ [data-theme="light"] { --bg: #f5f7fb; --panel: #ffffff; --text: #222; --muted: #5b6470; /* 浅色用黑色 */ --primary: #000000; --primary-600: #222222; --danger: #e95353; --success: #22b66b; --border: #e6e8ef; --card: #ffffff; --ring: rgba(0,0,0,0.15); --active-text: #ffffff; --switch-knob-checked: #ffffff; } /* 浅色覆盖 */ [data-theme="light"] .app-header { background: rgba(255,255,255,0.8); border-bottom-color: var(--border); } [data-theme="light"] .tab-btn { color: var(--muted); border-color: var(--border); background: #fff; } [data-theme="light"] .tab-btn.active { background: var(--primary); color: var(--active-text); border-color: transparent; } [data-theme="light"] button { background: #ffffff; color: #1a1a1a; border-color: var(--border); } [data-theme="light"] button:hover { background: #f6f7fb; border-color: #d6dbe8; } [data-theme="light"] button.primary { color: var(--active-text) !important; } [data-theme="light"] .result img { background: #fff; border-color: var(--border); } [data-theme="light"] .toast { background: rgba(255,255,255,0.96); color: #222; } /* 主要按钮文字颜色由 --active-text 控制(浅色=白、深色=黑) */ /* ===== 可读性增强与无障碍优化 ===== */ input::placeholder, textarea::placeholder { color: var(--placeholder); opacity: 1; } select, option { color: var(--text); background: var(--card); } input, textarea, select { caret-color: var(--primary); font-size: 15px; } .message { color: var(--muted); } /* 主题占位符颜色 */ :root, [data-theme="dark"] { --placeholder: #b8c1d1; } [data-theme="light"] { --placeholder: #8a93a8; } /* ===== 移动端优化 ===== */ @media (max-width: 640px) { /* 手机端隐藏仅桌面端的元素 */ .desktop-only { display: none !important; } /* 目录操作按钮在移动端也显示 */ .dir-actions { display: flex !important; flex-direction: column; gap: 8px; } .dir-actions button { width: 100%; } /* 手机端背景图片 */ body { background-image: url('/image2/punk.png'); background-size: cover; background-position: center; } /* 显示汉堡菜单 */ .menu-toggle { display: block; } /* 隐藏顶部tabs和actions */ .app-header .tabs, .app-header .header-actions { display: none; } /* 顶部导航栏简化 - 更小更紧凑,汉堡栏在最左边 */ .app-header { padding: 4px 10px; flex-direction: row; align-items: center; gap: 8px; min-height: 32px; } /* 汉堡菜单放最左边 */ .menu-toggle { order: -1; margin-right: auto; } .brand { font-size: 11px; font-weight: 600; letter-spacing: 0.3px; position: absolute; left: 50%; transform: translateX(-50%); } /* 主容器调整 - 减小padding,内容向上靠 */ main { padding: 36px 8px 10px; max-width: 100%; } /* 卡片优化 - 减小padding */ .card { padding: 10px 8px; border-radius: var(--radius); } /* 表单网格优化 - 移动端两列(除了全宽) */ .form-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px; } /* 全宽元素(正负面提示词)保持单列 */ .form-grid label.full { grid-column: 1 / -1; } /* 触控友好的输入框 - 更紧凑 */ input[type="text"], input[type="password"], input[type="number"], input[type="color"], select { padding: 8px 10px; font-size: 14px; border-radius: var(--radius); min-height: 36px; } textarea { padding: 8px 10px; font-size: 14px; min-height: 70px; } /* 按钮优化 - 更紧凑 */ button { padding: 10px 16px; font-size: 14px; min-height: 40px; border-radius: var(--radius); } /* 开关优化 */ .switch { padding: 8px 0; } .switch input[type="checkbox"] { width: 50px; height: 30px; } .switch input[type="checkbox"]::after { width: 24px; height: 24px; top: 2px; left: 2px; } .switch input[type="checkbox"]:checked::after { transform: translateX(20px); } /* 底部固定操作栏:仅对生成页面固定 */ #tab-t2i .actions, #tab-i2i .actions, #tab-inpaint .actions { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px; background: var(--panel); border-top: 1px solid var(--border); z-index: 80; box-shadow: 0 -4px 12px rgba(0,0,0,0.15); display: flex; justify-content: center; } #tab-t2i .actions .primary, #tab-i2i .actions .primary, #tab-inpaint .actions .primary { width: 100%; max-width: 400px; font-size: 17px; font-weight: 700; padding: 16px 24px; } /* 配置页面的 actions 保持正常流式布局 */ #tab-config .actions { position: relative; padding: 16px 0; flex-direction: column; } #tab-config .actions button { width: 100%; } /* 为生成页面预留底部空间 */ #tab-t2i .card, #tab-i2i .card, #tab-inpaint .card { padding-bottom: 90px; } /* 结果展示优化 - 更大空间 */ .result { margin-top: 16px; gap: 12px; } .result img { border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0,0,0,0.15); max-width: 100%; height: auto; min-height: 300px; object-fit: contain; } /* 图片信息区域 */ .image-info { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; font-size: 13px; line-height: 1.6; } .image-info-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); } .image-info-title { font-weight: 700; font-size: 14px; color: var(--text); } .image-info-toggle { appearance: none; background: var(--card); border: 1px solid var(--border); color: var(--text); cursor: pointer; padding: 4px 12px; font-size: 12px; font-weight: 600; border-radius: var(--radius); transition: all 0.2s ease; } .image-info-toggle:active { transform: scale(0.95); } .image-info-content { display: none; margin-top: 8px; } .image-info-content.expanded { display: block; animation: slideDown 0.2s ease; } @keyframes slideDown { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } } .image-info-row { margin-bottom: 10px; word-break: break-word; display: flex; flex-direction: column; gap: 4px; } .image-info-row:last-child { margin-bottom: 0; } .image-info-label { color: var(--muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; } .image-info-value { color: var(--text); font-size: 13px; line-height: 1.5; padding-left: 8px; } /* 隐藏保存路径(文本框) */ .saved-path { display: none; } /* 图片操作按钮区域 - 移动端样式 */ .image-actions { display: flex; justify-content: center; padding: 12px 0; } .save-btn { width: 100%; max-width: 300px; padding: 14px 20px; font-size: 16px; justify-content: center; } /* Toast 优化 - 顶部不占位 */ .toast { top: 45px; max-width: calc(100% - 32px); padding: 10px 12px; font-size: 13px; } /* 标题优化 - 更小 */ h2 { font-size: 15px; margin: 0 0 10px; font-weight: 700; } /* 标签字体优化 - 更小 */ label { font-size: 12px; } label > span { font-weight: 600; margin-bottom: 2px; } /* 信息提示优化 */ .message { font-size: 12px; margin-top: 8px; } /* 滚动条隐藏(更流畅的移动体验) */ * { scrollbar-width: thin; scrollbar-color: var(--border) transparent; } *::-webkit-scrollbar { width: 2px; height: 2px; } *::-webkit-scrollbar-track { background: transparent; } *::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; } }