diff --git a/docs/DESIGN.md b/docs/DESIGN.md index 7069f37..41fc214 100644 --- a/docs/DESIGN.md +++ b/docs/DESIGN.md @@ -1,7 +1,19 @@ # PERLER LAB 设计规范(DESIGN.md) -> 版本: 1.0 | 适用: 首页(图片转拼豆) + AI专区(/chibi) + 弹窗 -> 参考竞品: xylpindou.com(已逆向)· 风格: 温暖纸张质感 + 高级极简 +> 版本: 2.0 | 适用: 全站(首页/AI专区/豆仓/图纸库/弹窗) +> 风格: 温暖手作(warm craft):纸张质感 + 琥珀主色 + 圆润触感 + 克制动效 +> v2.0 变更: 字体真实加载、字号上调、动效令牌、八态交互、无障碍修复、签名质感 +> 依据: design-taste skill(Emil Kowalski 动效工艺 + impeccable 反AI味 + taste-skill 预检) + +--- + +## 0. 设计判读(Design Read) + +- **产品**: 拼豆图纸生成器,创意手工工具 +- **受众**: 拼豆手工爱好者(休闲、耐心、注重成品美感) +- **气质关键词**: 温暖、纸张、手作、像素颗粒感、亲切不幼稚 +- **签名元素**: 拼豆底板(pegboard)圆点阵列 —— 唯一允许的装饰纹理,仅用于 Hero 与上传区 +- **强度拨盘**: DESIGN_VARIANCE 4 / MOTION_INTENSITY 4 / VISUAL_DENSITY 4 --- @@ -10,277 +22,260 @@ ### 1.1 色彩系统 ```css :root { - /* 背景层级 */ + /* 背景层级(暖纸) */ --bg-page: #f4f3ef; /* 页面底色:米白纸张 */ - --bg-card: #ffffff; /* 卡片底色 */ + --bg-card: #fffefa; /* 卡片:暖白(不用纯白) */ --bg-subtle: #f0ede4; /* 次级底色:标签/计数 */ --bg-hover: #faf9f4; /* 悬停底色 */ - /* 文字层级 */ - --text-primary: #171713; /* 主文字:墨黑 */ - --text-secondary: #66645d; /* 次文字 */ - --text-tertiary: #8a877d; /* 辅助文字 */ - --text-disabled: #b0aca0; /* 禁用文字 */ - --text-on-dark: #ffffff; /* 深色底上的白字 */ + /* 文字层级(暖墨) */ + --text-primary: #1f1d17; /* 主文字:暖墨黑 */ + --text-secondary: #615e54; + --text-tertiary: #8a877d; + --text-disabled: #b0aca0; + --text-on-dark: #fffefa; /* 功能色 */ - --accent: #edb045; /* 强调橙:CTA/推荐标签 */ - --success: #3daf80; /* 成功绿:通过/已支付 */ - --danger: #e04f4f; /* 危险红:错误/不合格 */ - --info: #3677d2; /* 信息蓝:链接/进行中 */ + --accent: #edb045; /* 琥珀:CTA 底色/选中态 */ + --accent-hover: #e3a335; /* CTA 悬停 */ + --accent-strong: #d18f1f; /* CTA 按下/描边加深 */ + --accent-ink: #8a5c08; /* 亮底上的琥珀文字(≥4.5:1):链接/强调字 */ + --accent-soft: #f7e3bb; /* 琥珀浅底:选中项背景/焦点光晕 */ + --success: #2f9e77; + --danger: #d94848; + --danger-soft: #fbeaea; + --info: #3677d2; /* 边框 */ - --border: #e6e3d9; /* 卡片边框 */ - --border-strong: #d2cec4; /* 强调边框 */ - --border-dashed: #e0dccd; /* 虚线分隔 */ + --border: #e6e3d9; + --border-strong: #d2cec4; + --border-dashed: #ddd8c8; - /* 网格线(图纸) */ + /* 网格线(图纸导出专用,不改) */ --grid-strong: rgba(20,20,18,.78); --grid-medium: rgba(30,30,28,.45); --grid-light: rgba(30,30,28,.16); } ``` +**对比度硬规则(v2 无障碍修复)**: +- 琥珀底 `--accent` 上的文字一律用 `--text-primary`(约 9:1),**禁止白字**(仅 1.9:1,v1 历史错误) +- 亮底上的琥珀色**文字**(hero 强调字/链接)用 `--accent-ink`,禁止 `--accent` 直接作字色 +- 正文对比度 ≥4.5:1;大字(≥18px bold)≥3:1;placeholder 同样 ≥4.5:1 + ### 1.2 字体系统 +```html + + + + +``` ```css :root { - --font-sans: "Geist", system-ui, -apple-system, "Segoe UI", "PingFang SC", - "Microsoft YaHei", sans-serif; - --font-mono: "Geist Mono", ui-monospace, "Cascadia Code", Consolas, monospace; - --text-xs: 11px; /* 辅助/标签 */ - --text-sm: 12px; /* 次要 */ - --text-md: 13px; /* 正文 */ - --text-lg: 17px; /* 卡片标题/按钮 */ - --text-xl: 20px; /* 区块标题 */ - --text-hero: 32px; /* Hero H1 */ + /* Nunito(圆端人文 sans,拉丁/数字)+ 系统 CJK。圆端字形呼应"圆润豆子" */ + --font-sans: "Nunito", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; + --font-mono: ui-monospace, "Cascadia Code", Consolas, monospace; /* 色号/尺寸值 */ + + --text-xs: 12px; /* 辅助标签(v1 11px 上调) */ + --text-sm: 13px; /* 次要说明 */ + --text-md: 14px; /* 正文(v1 13px 上调) */ + --text-lg: 18px; /* 卡片标题/弹窗标题 */ + --text-xl: 22px; /* 区块标题 */ + --text-hero: clamp(30px, 4.5vw, 42px); /* Hero H1,响应式 */ + --weight-regular: 400; - --weight-medium: 500; + --weight-medium: 600; /* Nunito 用 600(其 500 存在感弱) */ --weight-bold: 700; + --weight-black: 800; /* 仅 Hero H1 与价格数字 */ } ``` +- 标题行高 1.15-1.25;正文 1.55-1.65;h1-h3 加 `text-wrap: balance` +- 中文禁用斜体;hero `` 强调改用 `--accent-ink` + 加粗(v1 的斜体是硬伤) ### 1.3 间距 / 圆角 / 阴影 ```css :root { - --space-1: 4px; --space-2: 8px; --space-3: 12px; - --space-4: 16px; --space-5: 24px; --space-6: 32px; + --space-1: 4px; --space-2: 8px; --space-3: 12px; + --space-4: 16px; --space-5: 24px; --space-6: 32px; --space-7: 48px; - --radius-sm: 8px; /* 小控件/标签 */ - --radius-md: 10px; /* 卡片 */ - --radius-lg: 12px; /* 面板/弹窗 */ - --radius-full: 999px; /* 胶囊/圆形 */ + --radius-sm: 8px; + --radius-md: 10px; + --radius-lg: 14px; /* 面板/弹窗(更圆润,上限 16 内) */ + --radius-full: 999px; - --shadow-card: 0 1px 2px rgba(0,0,0,.04); - --shadow-modal: 0 8px 32px rgba(23,23,19,.14); - --shadow-float: 0 2px 12px rgba(23,23,19,.08); + /* 暖调分层阴影(阴影模糊 ≤12px;禁边框+大阴影组合) */ + --shadow-card: 0 1px 2px rgba(31,29,23,.05), 0 2px 8px rgba(31,29,23,.04); + --shadow-modal: 0 12px 40px rgba(31,29,23,.18), 0 2px 8px rgba(31,29,23,.08); + --shadow-float: 0 2px 10px rgba(31,29,23,.10); } ``` -### 1.4 触控目标 +### 1.4 触控 / 焦点 / 动效令牌(v2 新增) ```css -/* 移动端最小触控区域 */ ---touch-min: 40px; /* 按钮 */ ---touch-min-sm: 34px; /* 标签按钮/导航 */ +:root { + --touch-min: 44px; /* v1 40 上调(WCAG) */ + --touch-min-sm: 36px; + + /* 焦点环:所有可交互元素统一 */ + --focus-ring: 0 0 0 3px rgba(237,176,69,.45); + + /* 动效:只动 transform/opacity;UI 全部 <300ms */ + --ease-out: cubic-bezier(0.23, 1, 0.32, 1); + --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1); + --dur-fast: 150ms; /* 按压/悬停反馈 */ + --dur-med: 220ms; /* 弹窗/下拉进出场 */ + --dur-slow: 300ms; /* 大面板/页面级过渡 */ +} ``` --- -## 2. 首页布局(图片转拼豆) +## 2. 签名质感(v2 新增) -### 2.1 页面骨架 +### 2.1 Pegboard 圆点纹理(唯一装饰纹理) +```css +/* 仅 Hero 区与上传区使用。圆点 = 拼豆底板,产品符号而非随机装饰 */ +.hero { + background: + radial-gradient(rgba(209,143,31,0.10) 1.5px, transparent 1.5px) 0 0 / 22px 22px, + var(--bg-page); +} +.upload-zone:hover { + background: + radial-gradient(rgba(209,143,31,0.12) 1.5px, transparent 1.5px) 0 0 / 22px 22px, + var(--bg-hover); +} ``` -┌────────────────────────────────────────────┐ -│ NAV: [P] PERLER LAB | 图片转拼豆 | AI拼豆专区[PRO] | 代理合作 | ● 普通预览免费·AI生成按次付费 │ -├────────────────────────────────────────────┤ -│ HERO: IMAGE TO BEADS │ -│ 把喜欢的图片,变成一颗颗拼豆。 │ -│ 免费上传、生成和调整图纸… │ -│ [0 颗拼豆] [0 种颜色] │ -├────────────────────────────────────────────┤ -│ DOWNLOAD PASS: AI生成权益 | 3档套餐卡片 + CTA │ -├───────────────────┬──────────┬─────────────┤ -│ 01 生成设置 │ 02 实时预览│ 03 MARD备料 │ -│ 上传框 │ canvas │ 清单(锁定) │ -│ 尺寸滑杆 │ 标尺 │ 色号清单 │ -│ 颜色滑杆 │ 下载按钮 │ 10%备豆建议 │ -│ 背景去除/网格开关 │ │ │ -│ [↻ 重新生成图纸] │ │ │ -├───────────────────┴──────────┴─────────────┤ -│ FOOTER: PERLER LAB · 让每一颗颜色都有位置 │ -└────────────────────────────────────────────┘ -``` - -### 2.2 布局规格 -| 区域 | 规格 | -|---|---| -| 页面最大宽 | 1280px 居中,两侧留白 24px | -| 桌面三栏 | `grid-template-columns: 320px 1fr 280px; gap: 16px` | -| Hero | 上 64px 下 48px,左对齐 | -| NAV 高度 | 56px,sticky 顶部,白底+细边框 | -| 移动端 | 单列纵向:Hero → 套餐 → 生成设置 → 预览 → 备料清单;NAV 收起为汉堡/底部 CTA 条 | - -### 2.3 NAV 组件 -- 品牌:`P` 字母方块(品牌色底)+ "PERLER **LAB**" -- 链接:`图片转拼豆`(激活态:下划线/加粗)、`AI拼豆专区`(带 PRO 标签:橙底白字小胶囊) -- 右侧:`代理合作`(text 按钮)、状态徽标 `● 普通预览免费 · AI生成按次付费`(11px,灰字,绿点) - -### 2.4 Hero -- Eyebrow:11px 大写字母间距 `IMAGE TO BEADS`,橙色 -- H1:32px bold,关键短语 `变成一颗颗拼豆` 用 `` 橙色斜体 -- 副标题:14px 灰字 -- 统计:`0` 大数字 + 小字标签,竖线分隔 - -### 2.5 套餐卡片(Download Pass) -| 卡片 | 状态 | 规格 | -|---|---|---| -| 体验包 ¥4.9 3次 | 默认 | 白底+边框 | -| 常用包 ¥12.9 10次 | **推荐**(选中)| 橙边框 + `推荐` 角标 + 橙色 CTA | -| 进阶包 ¥29.9 30次 | 默认 | 白底+边框 | - -卡片结构:`套餐名 → 价格(¥X.X 大号) → N 次生成 → [购买]` -CTA 按钮:`购买 / 兑换 →`,主按钮橙底白字,圆角 10px,hover 加深。 - -### 2.6 工作区三栏 -- **01 生成设置**(左):上传框 → 文件行 → 尺寸滑杆 → 颜色滑杆 → 背景开关 → 网格开关 → 主按钮 -- **02 实时预览**(中):标题栏(`● 实时预览` 绿点 + `每5格加粗·每10格标号`)+ canvas + 底部(名称/尺寸/实际颗数 + 下载按钮) -- **03 MARD 备料清单**(右):`🔒 受保护` 标签 → 遮罩统计(•••• 实际总颗数 / •• 使用颜色)→ 4 行灰色色块行(`完整色号已隐藏`)→ 锁定卡(🔒 + `完整备料清单已锁定` + [输入兑换码解锁])→ `建议多备 10% · 约 •••• 颗` +- 全站其余区域禁止任何纹理/渐变条纹/装饰网格线 +- 图标一律 SVG 图标集(Lucide/Phosphor),禁止 emoji 作图标、禁止手绘涂鸦 SVG --- -## 3. 交互规范 +## 3. 交互规范(八态完整版) -### 3.1 上传框 +### 3.0 通用规则 +1. **每个可交互元素必须设计八态**:default / hover / focus / active / disabled / loading / error / success +2. **焦点环**:`:focus { outline: none }` 必须搭配 `:focus-visible { box-shadow: var(--focus-ring) }`,全站统一 +3. **按压反馈**:所有可按压元素 `:active { transform: scale(0.97) }` +4. **悬停门控**:hover 效果一律包在 `@media (hover: hover) { ... }` 内(防触屏误触发) +5. **进出场**:从 `opacity:0 + scale(0.95)` 进入,禁止 `scale(0)`;退场比进场快 +6. **减动效**:全局 `@media (prefers-reduced-motion: reduce)` 下动画/过渡时长归近零 +7. **表单**:label 永远在输入框上方;失焦校验;错误在字段下方并 `aria-describedby` 关联 +8. **弹窗**:ESC + 点遮罩可关;打开时锁 body 滚动;关闭按钮用 SVG 图标(不用文字 ✕) + +### 3.1 按钮 +```css +/* 主按钮:琥珀底 + 暖墨字(对比度修复,v1 白字废弃) */ +.btn-primary { + min-height: var(--touch-min); + padding: 0 var(--space-5); + border-radius: var(--radius-md); + background: var(--accent); + color: var(--text-primary); + font-size: var(--text-md); font-weight: var(--weight-bold); + transition: transform var(--dur-fast) var(--ease-out), + background var(--dur-fast) ease, + box-shadow var(--dur-fast) ease; +} +@media (hover: hover) { + .btn-primary:hover:not(:disabled) { background: var(--accent-hover); box-shadow: var(--shadow-float); } +} +.btn-primary:active:not(:disabled) { transform: scale(0.97); background: var(--accent-strong); } +.btn-primary:focus-visible { outline: none; box-shadow: var(--focus-ring); } +.btn-primary:disabled { background: var(--bg-subtle); color: var(--text-disabled); cursor: not-allowed; } +``` +- 变体:`.btn-secondary`(暖白底+边框,hover 边框转琥珀)/ `.btn-ghost`(无底无框,hover 背景 subtle)/ `.btn-danger`(--danger 底白字) +- loading 态:14px 双边框 spinner 旋转 0.7s linear,文字保持 +- 按钮文案 = 动词 + 宾语("登录豆仓"/"生成图纸"/"去支付") + +### 3.2 输入框 +```css +.input { + width: 100%; min-height: var(--touch-min); + padding: 0 var(--space-4); + border: 1.5px solid var(--border-strong); + border-radius: var(--radius-md); + background: var(--bg-card); + font-size: var(--text-md); color: var(--text-primary); + transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease; +} +.input::placeholder { color: var(--text-disabled); } +.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); } +.input--error { border-color: var(--danger); background: var(--danger-soft); } +``` + +### 3.3 弹窗 +```css +.modal-mask { + position: fixed; inset: 0; z-index: 200; + background: rgba(31,29,23,.45); + display: grid; place-items: center; padding: var(--space-4); + animation: mask-in var(--dur-med) ease both; +} +.modal { + width: 100%; max-width: 400px; + background: var(--bg-card); + border-radius: var(--radius-lg); + box-shadow: var(--shadow-modal); + padding: var(--space-6) var(--space-5) var(--space-5); + transform-origin: center; /* 弹窗保持中心缩放 */ + animation: modal-in var(--dur-med) var(--ease-out) both; +} +@keyframes mask-in { from { opacity: 0; } } +@keyframes modal-in { from { opacity: 0; transform: scale(0.95) translateY(8px); } } +``` +- 结构:标题(lg bold)→ 说明(sm secondary)→ 表单 → 主按钮(通栏)→ 切换链接 +- 登录/注册切换用 150ms 淡入淡出,不做滑动 + +### 3.4 上传框 | 状态 | 样式 | |---|---| -| idle | 虚线边框,`+` 大图标,`上传一张图片` + `支持 JPG、PNG、WEBP` | -| hover | 边框橙色,背景 `--bg-hover` | -| loading | 转圈 spinner,文字 `图片处理中…` | -| error | 红边 + 错误文案(如 `图片读取失败,请换一张`) | -| 成功 | 显示缩略图 + 文件名,出现 `重置` 按钮 | +| idle | 1.5px 虚线边框 + pegboard 纹理 + `+`(SVG 图标) | +| hover | 边框琥珀 + 纹理加深 + `translateY(-1px)` | +| loading | spinner + `图片处理中…` | +| error | 红边 + 错误文案 | +| 成功 | 缩略图 + 文件名 + 重置按钮 | -### 3.2 滑杆(Range) -- 尺寸:min 16 / max 128 / step 8,刻度标签 16/48/80/128 + 快捷按钮 32/64/96/128 -- 颜色:min 8 / max 48 / step 4,提示 `颜色越多还原度越高;默认推荐 24 色` -- 实时值显示在右侧 `32 × 32` -- 进度条已填充部分用橙色,thumb 白色带橙色描边 +### 3.5 Toggle 开关 +- 轨道 40x22,knob 16px;开启 `--accent` 底 +- `transition: transform 180ms var(--ease-out), background 180ms ease` -### 3.3 Toggle 开关 -- 开:橙色背景,圆形滑块右移;关:灰底滑块左移 -- 行内结构:`[标签] [说明小字] ... [开关]` -- 背景去除开关默认关;辅助网格开关默认开 +### 3.6 导航 +- 高 60px sticky,暖白底 + 底边框 +- 链接 hover:颜色加深 + 底部 2px 琥珀短线 `scaleX(0)→1` 淡入 +- 激活态:`--accent-ink` 字色 + 短线常驻 +- 品牌块 `P`:琥珀底暖墨字(对比度同步修复) -### 3.4 锁定清单(未兑换状态) -- 统计数字用 `••••` 遮罩(真实值隐藏) -- 色号行显示 `完整色号已隐藏` + 灰色色块 -- 锁定卡:🔒 图标 + `完整备料清单已锁定` + 小字说明 + `输入兑换码解锁` 按钮(次级按钮) +### 3.7 卡片(套餐/作品) +- 暖白底 1px 边框 + `--shadow-card` +- hover(门控内):`translateY(-2px)` + `--shadow-float` +- 推荐卡:2px `--accent` 边框 + 角标;禁止第三种强调手段叠加 +- 圆角 ≤14px;**禁止嵌套卡片** -### 3.5 弹窗 -| 弹窗 | 触发 | 内容 | 规格 | -|---|---|---|---| -| 兑换码 | 点 `输入兑换码解锁` | 输入框 + `兑换` 按钮 + 错误提示 | 居中 modal,圆角 12px,阴影 modal | -| 订单 | 点套餐 CTA | 套餐信息 + 支付方式选择(微信/支付宝 tab) + `去支付` | 同上 | -| 支付 | 订单确认 | 支付二维码/链接 + `我已支付` + `支付失败?` | 同上 | +### 3.8 列表进场(豆仓/图纸库/Showcase) +- 卡片 stagger 进场:`opacity 0→1 + translateY(8px)→0`,每项延迟 40ms,单项 ≤300ms +- 仅首次挂载播放;翻页/筛选不重播 -弹窗通用:遮罩 rgba(23,23,19,.4),内容卡 max-width 380px,右上角 `×` 关闭。 +### 3.9 反AI味禁令(本项目落地) +- 禁:侧边色条卡片、渐变文字、玻璃拟态、三等分同构卡片阵列、每节 eyebrow、01/02 编号脚手架 +- 禁:`—`(em-dash)出现在任何 UI 文案;分隔用空格/竖线/换行 +- 禁:纯黑 `#000`/纯白 `#fff`(用暖墨/暖白) +- 禁:`border-radius: 24px+` 的过度圆角;卡片上限 14px +- 禁:边框+大阴影(≥16px 模糊)同时出现在一个元素上 --- -## 4. AI 专区页(/chibi) +## 4. 落地映射(v2 实施指引) -### 4.1 页面骨架 -``` -NAV (chibi 版): [← 普通拼豆] PERLER LAB | ● 每次生成消耗 1 次权益 -BEAD HERO: IMAGE TO PERLER | 先选大类,再定细节,生成结果先保存。 -BEAD BUILDER: - 01 选择拼豆大类 [风景][人物][宠物]✓[物品][食物] - └ 大类对比图 (原图 → 像素拼豆效果) - └ 细分选择 (如宠物: 猫咪头像✓/狗狗全身/双宠互动) - 02 图纸格数 48简单 / 64推荐✓ / 80精细 / 96高清 - 03 最大颜色数 16省豆 / 24均衡✓ / 32细腻 / 40高还原 - 04 主体构图 主体特写✓ / 半幅构图 / 完整构图 - 05 细节提示词 标签多选(最多5) + 补充文本域(160字) + 参考图上传 -生成前确认: - 选中示例图 | 规格摘要(类别/细分/图纸/预计颗数) | [上传原图] | 付费说明 | [兑换后生成→] -PROMISE: 分类更准确 / 生成按次计费 / 结果防丢失 -FOOTER -``` - -### 4.2 分类 Tabs -- 5 个分类:风景(山川、城市和旅行纪念) / 人物(五官、发型和穿搭清楚) / 宠物(毛色、表情和品种特征) / 物品(手办、礼物和纪念物) / 食物(甜品、饮品和特色美食) -- 选中态:橙底白字;默认:白底边框 -- 每个分类下方:对比图区(原图 → 像素图)+ 3 个细分按钮 - -### 4.3 细分与标签 -- 每类 3 细分,如宠物:`猫咪头像`(圆润脸型与花纹) / `狗狗全身`(耳朵、四肢和毛色) / `双宠互动`(两只宠物同框) -- 提示词标签:`✓ 眼睛更有神`(已选,橙勾)`+ 保留项圈配饰`(未选,加号) -- 最多选 5 个,超出置灰提示 `最多选 5 项` - -### 4.4 参数选项行 -- 格数:48简单 / **64推荐** / 80精细 / 96高清(4 等分按钮组) -- 颜色:16省豆 / **24均衡** / 32细腻 / 40高还原 -- 构图:主体特写 / 半幅构图 / 完整构图(3 等分) -- 选中态:橙底白字圆角 8px - -### 4.5 生成按钮 -- 未兑换:`兑换后生成 →`(disabled 灰底),点击弹兑换码窗 -- 已兑换:`生成 →`(橙底白字) -- 生成中:spinner + `AI 生成中…` -- 文案提示:`每次 AI 成功生成扣 1 次;本作品转图纸和首次下载免费,失败不扣` - ---- - -## 5. 图纸导出规范(PNG) - -### 5.1 画布布局 -``` -┌──────────────────────────────────────────┐ -│ 标题: {作品名} · {N}×{N} · MARD 拼豆图纸 │ (24px bold, 左边距 80px) -├──────────────────────────────────────────┤ -│ ┌──────────────────────────────────┐ │ -│ │ 拼豆网格 (N×N, 每格 28px/22px) │ │ ← 顶部+左侧 80px 边距 -│ │ 每格: 豆圆(半径0.42格) + 色号 │ │ -│ └──────────────────────────────────┘ │ -│ 标尺: 每10格粗线+数字, 每5格中粗线 │ -├──────────────────────────────────────────┤ -│ MARD 备豆清单 │ (28px bold) -│ 共 {总颗数} 颗 · {颜色数} 种颜色 · 建议多备 10% (约 {1.1×总} 颗) │ -│ [色块] {色号} {颗数} [色块] {色号} {颗数} ... (每行 3-4 个) │ -└──────────────────────────────────────────┘ -``` - -### 5.2 尺寸规则 -| 项目 | 值 | +| 现有类 | 处置 | |---|---| -| 单元格 | gridSize ≥ 96 用 22px,否则 28px | -| 画布宽 | `gridSize × 28/22 + 160` | -| 画布高 | 标题区 80 + 网格 + 清单区(每行 44px + 留白) | -| 网格起点 | (80, 80) | -| 豆圆半径 | 0.42 × 单元格 | +| `styles.css :root` | 按 §1 全量替换 token(保留 --grid-* 不动) | +| `.pass-cta / .regen-btn / .download-btn / .redeem-btn / .mobile-cta-btn` | 统一收敛到 `.btn-primary` 规格(琥珀底暖墨字) | +| `.modal / .modal-mask` | 按 §3.3 加进出场动画 | +| `AuthModal.tsx`(bd-* + 内联样式) | 重写:换用设计系统类,去内联样式/紫色 fallback,加 loading spinner + SVG 关闭图标 | +| `index.html` | 加 Nunito 字体链接 | +| `.hero` | 加 pegboard 纹理;`` 去斜体改 `--accent-ink` 加粗 | +| `.nav-link` | hover 短线 scaleX 动效 | +| 全局 | 追加 focus-visible 环、prefers-reduced-motion、hover 门控 | -### 5.3 网格线 -| 类型 | 颜色 | 线宽 | -|---|---|---| -| 每 10 格 | `rgba(20,20,18,.78)` | 2.6px + 标号(粗体 14px) | -| 每 5 格 | `rgba(30,30,28,.45)` | 1.7px | -| 其余 | `rgba(30,30,28,.16)` | 1px | - -### 5.4 色号文字对比度 -- 规则:`lab[0] < 52`(深色底)→ 白字 `#fff`;否则 → 深字 `#171713` -- 字号:`max(7px, 0.28 × 单元格)`,加粗,居中 - -### 5.5 备豆清单 -- 色块:圆形 12px 半径,外圈 `#d2cec4` 描边 -- 布局:`[色块] {色号}(17px bold 左对齐) {颗数} 颗(15px 灰)` -- 每行 3-4 个(依据总宽度:>1800px 用 3 列,否则 4 列) - -### 5.6 文件名 -`{作品名}-{N}x{N}-MARD拼豆图纸.png` - ---- - -## 6. 响应式断点 -| 断点 | 行为 | -|---|---| -| ≥ 1024px | 桌面三栏布局 | -| 768–1023px | 两栏(设置+预览),备料清单下移 | -| ≤ 767px | 单栏纵向;NAV 简化;底部固定 `购买/兑换` CTA 条;分页按钮触控 ≥ 40px | +**范围外(保持不动)**:图纸导出规范(§5 v1 文档)、后端、i18n 文案键名、路由结构。 diff --git a/perler-lab/index.html b/perler-lab/index.html index 9826117..b82a2e6 100644 --- a/perler-lab/index.html +++ b/perler-lab/index.html @@ -5,6 +5,12 @@ + + + PERLER LAB · 拼豆图纸生成器 diff --git a/perler-lab/src/components/AuthModal.tsx b/perler-lab/src/components/AuthModal.tsx index ac7991e..d1fe2d9 100644 --- a/perler-lab/src/components/AuthModal.tsx +++ b/perler-lab/src/components/AuthModal.tsx @@ -1,13 +1,14 @@ /** - * AuthModal — 登录/注册弹窗,切换登录/注册模式。 + * AuthModal — 登录/注册弹窗(DESIGN.md v2.0 §3.3)。 * * 用例: * setOpen(false)} /> * * 登录成功后自动关闭弹窗,auth user 自动更新到 useAuth()。 + * 样式走 styles.css 全局设计系统(.modal/.field/.input),无内联样式。 */ -import { useCallback, useState, type FormEvent } from 'react'; +import { useCallback, useEffect, useRef, useState, type FormEvent } from 'react'; import { useT } from '../i18n'; import { useAuth } from '../lib/auth'; @@ -27,6 +28,25 @@ export default function AuthModal({ open, onClose }: AuthModalProps) { const [error, setError] = useState(null); const [loading, setLoading] = useState(false); + const phoneRef = useRef(null); + + // 打开时焦点落到第一个输入框 + useEffect(() => { + if (!open) return undefined; + const raf = requestAnimationFrame(() => phoneRef.current?.focus()); + return () => cancelAnimationFrame(raf); + }, [open]); + + // ESC 关闭 + useEffect(() => { + if (!open) return; + const onKey = (e: KeyboardEvent) => { + if (e.key === 'Escape') onClose(); + }; + window.addEventListener('keydown', onKey); + return () => window.removeEventListener('keydown', onKey); + }, [open, onClose]); + const switchMode = useCallback(() => { setMode((m) => (m === 'login' ? 'register' : 'login')); setError(null); @@ -65,36 +85,38 @@ export default function AuthModal({ open, onClose }: AuthModalProps) { if (!open) return null; return ( -
+
e.stopPropagation()} role="dialog" aria-modal="true" aria-label={t(mode === 'login' ? 'auth.loginTitle' : 'auth.registerTitle')} > {/* 标题 */} -
- +
+ {t(mode === 'login' ? 'auth.loginTitle' : 'auth.registerTitle')} -
{/* 提示 */} -

- {t('auth.syncHint')} -

+

{t('auth.syncHint')}

{/* 表单 */} -
+ {/* 手机号 */} -
- +
+ {/* 密码 */} -
- +
+ setPassword(e.target.value)} @@ -119,10 +142,11 @@ export default function AuthModal({ open, onClose }: AuthModalProps) { {/* 昵称(注册时) */} {mode === 'register' && ( -
- +
+ setNickname(e.target.value)} @@ -133,40 +157,31 @@ export default function AuthModal({ open, onClose }: AuthModalProps) { {/* 错误提示 */} {error && ( -

+

{error}

)} {/* 提交 */} - {/* 切换模式 */} -
-
); -} \ No newline at end of file +} diff --git a/perler-lab/src/pages/pages.css b/perler-lab/src/pages/pages.css index ef377be..2099883 100644 --- a/perler-lab/src/pages/pages.css +++ b/perler-lab/src/pages/pages.css @@ -1,57 +1,9 @@ /* ============================================================================= * PERLER LAB — Showcase 作品展示 (/showcase) + 图纸库 (/library) - * 令牌与 DESIGN.md §1 / ChibiPage.css 保持一致,作用域限定在 .pl-page 下 + * v2.0 起 token 统一由 styles.css :root 提供(DESIGN.md §1),此处不再作用域重定义 * ========================================================================= */ .pl-page { - /* ── 色彩系统 ── */ - --bg-page: #f4f3ef; - --bg-card: #ffffff; - --bg-subtle: #f0ede4; - --bg-hover: #faf9f4; - --text-primary: #171713; - --text-secondary: #66645d; - --text-tertiary: #8a877d; - --text-disabled: #b0aca0; - --text-on-dark: #ffffff; - --accent: #edb045; - --accent-hover: #dda02e; - --accent-soft: #fdf3df; - --success: #3daf80; - --danger: #e04f4f; - --info: #3677d2; - --border: #e6e3d9; - --border-strong: #d2cec4; - --border-dashed: #e0dccd; - - /* ── 字体系统 ── */ - --font-sans: "Geist", system-ui, -apple-system, "Segoe UI", "PingFang SC", - "Microsoft YaHei", sans-serif; - --text-xs: 11px; - --text-sm: 12px; - --text-md: 13px; - --text-lg: 17px; - --text-xl: 20px; - --text-hero: 32px; - - /* ── 间距 / 圆角 / 阴影 ── */ - --space-1: 4px; - --space-2: 8px; - --space-3: 12px; - --space-4: 16px; - --space-5: 24px; - --space-6: 32px; - --radius-sm: 8px; - --radius-md: 10px; - --radius-lg: 12px; - --radius-full: 999px; - --shadow-card: 0 1px 2px rgba(0, 0, 0, .04); - --shadow-float: 0 2px 12px rgba(23, 23, 19, .08); - - /* ── 触控目标 ── */ - --touch-min: 40px; - --touch-min-sm: 34px; - background: var(--bg-page); color: var(--text-primary); font-family: var(--font-sans); @@ -69,14 +21,6 @@ padding: 0; } -.pl-page button { - font-family: inherit; - cursor: pointer; - border: none; - background: none; - color: inherit; -} - .pl-page a { color: inherit; text-decoration: none; diff --git a/perler-lab/src/styles.css b/perler-lab/src/styles.css index 20746cc..e1e529f 100644 --- a/perler-lab/src/styles.css +++ b/perler-lab/src/styles.css @@ -1,52 +1,57 @@ /* ============================================================ - PERLER LAB · 设计令牌 (DESIGN.md §1) + PERLER LAB · 设计令牌 (DESIGN.md v2.0 §1) ============================================================ */ :root { - /* 背景层级 */ + /* 背景层级(暖纸) */ --bg-page: #f4f3ef; - --bg-card: #ffffff; + --bg-card: #fffefa; --bg-subtle: #f0ede4; --bg-hover: #faf9f4; - /* 文字层级 */ - --text-primary: #171713; - --text-secondary: #66645d; + /* 文字层级(暖墨) */ + --text-primary: #1f1d17; + --text-secondary: #615e54; --text-tertiary: #8a877d; --text-disabled: #b0aca0; - --text-on-dark: #ffffff; + --text-on-dark: #fffefa; /* 功能色 */ --accent: #edb045; - --accent-strong: #d99a2b; - --success: #3daf80; - --danger: #e04f4f; + --accent-hover: #e3a335; + --accent-strong: #d18f1f; + --accent-ink: #8a5c08; + --accent-soft: #f7e3bb; + --success: #2f9e77; + --danger: #d94848; + --danger-soft: #fbeaea; --info: #3677d2; /* 边框 */ --border: #e6e3d9; --border-strong: #d2cec4; - --border-dashed: #e0dccd; + --border-dashed: #ddd8c8; - /* 网格线(图纸) */ + /* 网格线(图纸导出专用,勿改) */ --grid-strong: rgba(20, 20, 18, 0.78); --grid-medium: rgba(30, 30, 28, 0.45); --grid-light: rgba(30, 30, 28, 0.16); - /* 字体 */ - --font-sans: 'Geist', system-ui, -apple-system, 'Segoe UI', 'PingFang SC', - 'Microsoft YaHei', sans-serif; - --font-mono: 'Geist Mono', ui-monospace, 'Cascadia Code', Consolas, monospace; + /* 字体:Nunito(拉丁/数字,圆端呼应豆子)+ 系统 CJK */ + --font-sans: 'Nunito', 'PingFang SC', 'Microsoft YaHei', system-ui, + -apple-system, 'Segoe UI', sans-serif; + --font-mono: ui-monospace, 'Cascadia Code', Consolas, monospace; /* 字号 */ - --text-xs: 11px; - --text-sm: 12px; - --text-md: 13px; - --text-lg: 17px; - --text-xl: 20px; - --text-hero: 32px; + --text-xs: 12px; + --text-sm: 13px; + --text-md: 14px; + --text-lg: 18px; + --text-xl: 22px; + --text-hero: clamp(30px, 4.5vw, 42px); --weight-regular: 400; - --weight-medium: 500; + --weight-medium: 600; --weight-bold: 700; + --weight-black: 800; /* 间距 */ --space-1: 4px; @@ -55,23 +60,30 @@ --space-4: 16px; --space-5: 24px; --space-6: 32px; + --space-7: 48px; - /* 圆角 / 阴影 */ + /* 圆角 / 阴影(暖调分层,模糊 ≤12px) */ --radius-sm: 8px; --radius-md: 10px; - --radius-lg: 12px; + --radius-lg: 14px; --radius-full: 999px; - --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04); - --shadow-modal: 0 8px 32px rgba(23, 23, 19, 0.14); - --shadow-float: 0 2px 12px rgba(23, 23, 19, 0.08); + --shadow-card: 0 1px 2px rgba(31, 29, 23, 0.05), 0 2px 8px rgba(31, 29, 23, 0.04); + --shadow-modal: 0 12px 40px rgba(31, 29, 23, 0.18), 0 2px 8px rgba(31, 29, 23, 0.08); + --shadow-float: 0 2px 10px rgba(31, 29, 23, 0.1); - /* 触控 */ - --touch-min: 40px; - --touch-min-sm: 34px; + /* 触控 / 焦点 / 动效 */ + --touch-min: 44px; + --touch-min-sm: 36px; + --focus-ring: 0 0 0 3px rgba(237, 176, 69, 0.45); + --ease-out: cubic-bezier(0.23, 1, 0.32, 1); + --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1); + --dur-fast: 150ms; + --dur-med: 220ms; + --dur-slow: 300ms; /* 布局 */ --layout-max: 1280px; - --nav-height: 56px; + --nav-height: 60px; } *, @@ -200,10 +212,10 @@ a { height: 28px; border-radius: var(--radius-sm); background: var(--accent); - color: var(--text-on-dark); + color: var(--text-primary); display: grid; place-items: center; - font-weight: var(--weight-bold); + font-weight: var(--weight-black); font-size: 16px; line-height: 1; } @@ -220,6 +232,7 @@ a { } .nav-link { + position: relative; font-size: var(--text-md); color: var(--text-secondary); padding: 4px 2px; @@ -227,24 +240,52 @@ a { display: inline-flex; align-items: center; gap: var(--space-1); + transition: color var(--dur-fast) ease; } -.nav-link:hover { - color: var(--text-primary); +/* 底部琥珀短线:hover 淡入,激活常驻 */ +.nav-link::after { + content: ''; + position: absolute; + left: 0; + right: 0; + bottom: -2px; + height: 2px; + border-radius: var(--radius-full); + background: var(--accent); + transform: scaleX(0); + transform-origin: left; + transition: transform var(--dur-fast) var(--ease-out); +} + +@media (hover: hover) { + .nav-link:hover { + color: var(--text-primary); + } + .nav-link:hover::after { + transform: scaleX(1); + } } .nav-link--active { - color: var(--text-primary); + color: var(--accent-ink); font-weight: var(--weight-medium); - text-decoration: underline; - text-underline-offset: 4px; - text-decoration-color: var(--accent); +} + +.nav-link--active::after { + transform: scaleX(1); +} + +.nav-link:focus-visible { + outline: none; + box-shadow: var(--focus-ring); + border-radius: 4px; } .nav-pro-badge { - font-size: 9px; + font-size: 10px; font-weight: var(--weight-bold); - color: var(--text-on-dark); + color: var(--text-primary); background: var(--accent); border-radius: var(--radius-full); padding: 1px 6px; @@ -281,8 +322,9 @@ a { } .nav-lang-btn--active { - color: var(--text-on-dark); + color: var(--text-primary); background: var(--accent); + font-weight: var(--weight-medium); } @@ -317,6 +359,13 @@ a { ============================================================ */ .hero { padding: 64px 0 48px; + /* Pegboard 圆点纹理:拼豆底板符号(DESIGN.md §2.1,全站唯一装饰纹理) */ + background: + radial-gradient(rgba(209, 143, 31, 0.1) 1.5px, transparent 1.5px) 0 0 / + 22px 22px, + var(--bg-page); + border-bottom: 1px solid var(--border); + margin-bottom: var(--space-6); } .hero-eyebrow { @@ -324,21 +373,24 @@ a { font-weight: var(--weight-bold); letter-spacing: 0.18em; text-transform: uppercase; - color: var(--accent-strong); + color: var(--accent-ink); margin: 0 0 var(--space-3); } .hero-title { font-size: var(--text-hero); - font-weight: var(--weight-bold); - line-height: 1.25; + font-weight: var(--weight-black); + line-height: 1.18; + letter-spacing: -0.01em; margin: 0 0 var(--space-4); max-width: 640px; + text-wrap: balance; } .hero-title em { - font-style: italic; - color: var(--accent-strong); + font-style: normal; + font-weight: var(--weight-black); + color: var(--accent-ink); } .hero-sub { @@ -412,6 +464,19 @@ a { flex-direction: column; gap: var(--space-2); box-shadow: var(--shadow-card); + transition: transform var(--dur-fast) var(--ease-out), + box-shadow var(--dur-fast) ease; +} + +@media (hover: hover) { + .pass-card:hover { + transform: translateY(-2px); + box-shadow: var(--shadow-float); + } +} + +.pass-card:focus-within { + box-shadow: var(--focus-ring); } .pass-card--featured { @@ -423,7 +488,7 @@ a { top: -10px; right: var(--space-4); background: var(--accent); - color: var(--text-on-dark); + color: var(--text-primary); font-size: var(--text-xs); font-weight: var(--weight-bold); padding: 2px 10px; @@ -436,9 +501,10 @@ a { } .pass-card-price { - font-size: 30px; - font-weight: var(--weight-bold); + font-size: 32px; + font-weight: var(--weight-black); line-height: 1.1; + font-variant-numeric: tabular-nums; } .pass-card-price small { @@ -453,22 +519,87 @@ a { margin: 0 0 var(--space-3); } -.pass-cta { - margin-top: auto; +/* ---- 主按钮共享规格(DESIGN.md §3.1:琥珀底暖墨字) ---- */ +.pass-cta, +.regen-btn, +.download-btn, +.redeem-btn, +.mobile-cta-btn { min-height: var(--touch-min); border-radius: var(--radius-md); - font-size: var(--text-md); - font-weight: var(--weight-medium); - color: var(--text-on-dark); background: var(--accent); - padding: 0 var(--space-4); - transition: background 0.15s ease; + color: var(--text-primary); + font-size: var(--text-md); + font-weight: var(--weight-bold); + display: inline-flex; + align-items: center; + justify-content: center; + gap: var(--space-2); + padding: 0 var(--space-5); + transition: transform var(--dur-fast) var(--ease-out), + background var(--dur-fast) ease, box-shadow var(--dur-fast) ease; } -.pass-cta:hover { +@media (hover: hover) { + .pass-cta:hover:not(:disabled), + .regen-btn:hover:not(:disabled), + .download-btn:hover:not(:disabled), + .redeem-btn:hover:not(:disabled), + .mobile-cta-btn:hover:not(:disabled) { + background: var(--accent-hover); + box-shadow: var(--shadow-float); + } +} + +.pass-cta:active:not(:disabled), +.regen-btn:active:not(:disabled), +.download-btn:active:not(:disabled), +.redeem-btn:active:not(:disabled), +.mobile-cta-btn:active:not(:disabled) { + transform: scale(0.97); background: var(--accent-strong); } +.pass-cta:focus-visible, +.regen-btn:focus-visible, +.download-btn:focus-visible, +.redeem-btn:focus-visible, +.mobile-cta-btn:focus-visible { + outline: none; + box-shadow: var(--focus-ring); +} + +.pass-cta:disabled, +.regen-btn:disabled, +.download-btn:disabled, +.redeem-btn:disabled, +.mobile-cta-btn:disabled { + background: var(--bg-subtle); + color: var(--text-disabled); + box-shadow: none; + cursor: not-allowed; + transform: none; +} + +/* 各按钮原有布局差异保留 */ +.pass-cta { + margin-top: auto; +} + +.regen-btn { + width: 100%; + margin-top: var(--space-5); +} + +.download-btn { + padding: 0 var(--space-4); +} + +.download-btn:disabled { + background: var(--bg-subtle); + color: var(--text-disabled); +} + .pass-cta--outline { background: var(--bg-card); color: var(--text-primary); @@ -551,12 +682,24 @@ a { gap: var(--space-2); text-align: center; cursor: pointer; - transition: border-color 0.15s ease, background 0.15s ease; + transition: border-color var(--dur-fast) ease, + transform var(--dur-fast) var(--ease-out); } -.upload-zone:hover { - border-color: var(--accent); - background: var(--bg-hover); +@media (hover: hover) { + .upload-zone:hover { + border-color: var(--accent); + transform: translateY(-1px); + background: + radial-gradient(rgba(209, 143, 31, 0.12) 1.5px, transparent 1.5px) 0 0 / + 22px 22px, + var(--bg-hover); + } +} + +.upload-zone:focus-visible { + outline: none; + box-shadow: var(--focus-ring); } .upload-zone--error { @@ -567,6 +710,12 @@ a { font-size: 26px; color: var(--text-tertiary); line-height: 1; + transition: color var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out); +} + +.upload-zone:hover .upload-plus { + color: var(--accent-ink); + transform: scale(1.1); } .upload-title { @@ -684,19 +833,31 @@ a { color: var(--text-secondary); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); - transition: all 0.15s ease; + transition: border-color var(--dur-fast) ease, color var(--dur-fast) ease, + background var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out); } -.preset-btn:hover { - border-color: var(--accent); - color: var(--text-primary); +@media (hover: hover) { + .preset-btn:hover { + border-color: var(--accent); + color: var(--text-primary); + } +} + +.preset-btn:active { + transform: scale(0.97); +} + +.preset-btn:focus-visible { + outline: none; + box-shadow: var(--focus-ring); } .preset-btn--active { background: var(--accent); border-color: var(--accent); - color: var(--text-on-dark); - font-weight: var(--weight-medium); + color: var(--text-primary); + font-weight: var(--weight-bold); } /* Toggle 开关 (§3.3) */ @@ -730,11 +891,16 @@ a { height: 22px; border-radius: var(--radius-full); background: var(--border-strong); - transition: background 0.15s ease; + transition: background 180ms ease; flex-shrink: 0; min-height: 22px; } +.toggle:focus-visible { + outline: none; + box-shadow: var(--focus-ring); +} + .toggle--on { background: var(--accent); } @@ -748,43 +914,18 @@ a { border-radius: 50%; background: #ffffff; box-shadow: var(--shadow-float); - transition: transform 0.15s ease; + transition: transform 180ms var(--ease-out); } .toggle--on .toggle-knob { transform: translateX(18px); } -.regen-btn { - width: 100%; - min-height: var(--touch-min); - margin-top: var(--space-5); - border-radius: var(--radius-md); - background: var(--text-primary); - color: var(--text-on-dark); - font-size: var(--text-md); - font-weight: var(--weight-medium); - display: inline-flex; - align-items: center; - justify-content: center; - gap: var(--space-2); - transition: opacity 0.15s ease; -} - -.regen-btn:hover:not(:disabled) { - opacity: 0.88; -} - -.regen-btn:disabled { - opacity: 0.5; - cursor: not-allowed; -} - .regen-spinner { width: 14px; height: 14px; - border: 2px solid rgba(255, 255, 255, 0.35); - border-top-color: #ffffff; + border: 2px solid rgba(31, 29, 23, 0.25); + border-top-color: var(--text-primary); border-radius: 50%; animation: spin 0.7s linear infinite; } @@ -847,30 +988,6 @@ a { white-space: nowrap; } -.download-btn { - min-height: var(--touch-min); - padding: 0 var(--space-4); - border-radius: var(--radius-md); - background: var(--accent); - color: var(--text-on-dark); - font-size: var(--text-md); - font-weight: var(--weight-medium); - display: inline-flex; - align-items: center; - gap: var(--space-2); - transition: background 0.15s ease; -} - -.download-btn:hover:not(:disabled) { - background: var(--accent-strong); -} - -.download-btn:disabled { - background: var(--bg-subtle); - color: var(--text-disabled); - cursor: not-allowed; -} - .download-note { font-size: var(--text-xs); color: var(--text-tertiary); @@ -905,12 +1022,24 @@ a { justify-content: center; gap: var(--space-2); cursor: pointer; - transition: border-color 0.15s ease, color 0.15s ease; + transition: border-color var(--dur-fast) ease, color var(--dur-fast) ease, + transform var(--dur-fast) var(--ease-out); } -.share-btn:hover { - border-color: var(--accent); - color: var(--accent); +@media (hover: hover) { + .share-btn:hover { + border-color: var(--accent); + color: var(--accent-ink); + } +} + +.share-btn:active { + transform: scale(0.97); +} + +.share-btn:focus-visible { + outline: none; + box-shadow: var(--focus-ring); } .share-toast { @@ -1207,26 +1336,42 @@ a { } /* ============================================================ - 弹窗 (§3.5) + 弹窗 (DESIGN.md §3.3) ============================================================ */ .modal-mask { position: fixed; inset: 0; - background: rgba(23, 23, 19, 0.4); + background: rgba(31, 29, 23, 0.45); z-index: 200; display: grid; place-items: center; padding: var(--space-4); + animation: mask-in var(--dur-med) ease both; } .modal { width: 100%; - max-width: 380px; + max-width: 400px; background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-modal); - padding: var(--space-5); + padding: var(--space-6) var(--space-5) var(--space-5); position: relative; + transform-origin: center; + animation: modal-in var(--dur-med) var(--ease-out) both; +} + +@keyframes mask-in { + from { + opacity: 0; + } +} + +@keyframes modal-in { + from { + opacity: 0; + transform: scale(0.95) translateY(8px); + } } .modal-close { @@ -1237,14 +1382,26 @@ a { height: var(--touch-min-sm); display: grid; place-items: center; - font-size: var(--text-lg); color: var(--text-tertiary); border-radius: var(--radius-sm); + transition: background var(--dur-fast) ease, color var(--dur-fast) ease, + transform var(--dur-fast) var(--ease-out); } -.modal-close:hover { - background: var(--bg-hover); - color: var(--text-primary); +@media (hover: hover) { + .modal-close:hover { + background: var(--bg-subtle); + color: var(--text-primary); + } +} + +.modal-close:active { + transform: scale(0.94); +} + +.modal-close:focus-visible { + outline: none; + box-shadow: var(--focus-ring); } .modal-title { @@ -1253,37 +1410,139 @@ a { margin: 0 0 var(--space-4); } +.modal-header { + display: flex; + align-items: center; + justify-content: space-between; + padding-right: var(--space-6); /* 给右上角关闭按钮留位 */ + margin: 0 0 var(--space-2); +} + +.modal-header .modal-title { + margin: 0; +} + +.modal-hint { + font-size: var(--text-sm); + color: var(--text-secondary); + line-height: 1.6; + margin: 0 0 var(--space-5); +} + +.modal-footer { + text-align: center; + margin-top: var(--space-4); +} + +/* 表单字段(AuthModal 等使用,DESIGN.md §3.2) */ +.field { + display: flex; + flex-direction: column; + gap: 6px; + margin-bottom: var(--space-4); +} + +.field-label { + font-size: var(--text-sm); + font-weight: var(--weight-medium); + color: var(--text-primary); +} + +.input { + width: 100%; + min-height: var(--touch-min); + border: 1.5px solid var(--border-strong); + border-radius: var(--radius-md); + padding: 0 var(--space-4); + font-size: var(--text-md); + font-family: inherit; + background: var(--bg-card); + color: var(--text-primary); + outline: none; + transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease; +} + +.input::placeholder { + color: var(--text-disabled); +} + +.input:focus { + border-color: var(--accent); + box-shadow: var(--focus-ring); +} + +.input--error { + border-color: var(--danger); + background: var(--danger-soft); +} + +.form-error { + display: flex; + align-items: flex-start; + gap: var(--space-2); + font-size: var(--text-sm); + color: var(--danger); + background: var(--danger-soft); + border-radius: var(--radius-sm); + padding: var(--space-2) var(--space-3); + margin: 0 0 var(--space-4); +} + +.btn-block { + width: 100%; +} + +/* 切换链接(登录/注册互切) */ +.switch-link { + background: none; + border: none; + color: var(--accent-ink); + cursor: pointer; + font-size: var(--text-sm); + font-weight: var(--weight-medium); + padding: var(--space-2); + border-radius: var(--radius-sm); + transition: font-weight var(--dur-fast) ease; +} + +@media (hover: hover) { + .switch-link:hover { + text-decoration: underline; + text-underline-offset: 3px; + } +} + +.switch-link:focus-visible { + outline: none; + box-shadow: var(--focus-ring); +} + .redeem-input { width: 100%; min-height: var(--touch-min); - border: 1px solid var(--border-strong); + border: 1.5px solid var(--border-strong); border-radius: var(--radius-md); padding: 0 var(--space-3); font-size: var(--text-md); font-family: var(--font-mono); - background: var(--bg-hover); + background: var(--bg-card); + color: var(--text-primary); outline: none; - transition: border-color 0.15s ease; + transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease; +} + +.redeem-input::placeholder { + color: var(--text-disabled); } .redeem-input:focus { border-color: var(--accent); + box-shadow: var(--focus-ring); } .redeem-btn { width: 100%; - min-height: var(--touch-min); margin-top: var(--space-3); - border-radius: var(--radius-md); - background: var(--accent); - color: var(--text-on-dark); - font-size: var(--text-md); - font-weight: var(--weight-medium); - transition: background 0.15s ease; -} - -.redeem-btn:hover { - background: var(--accent-strong); } .redeem-error { @@ -1404,11 +1663,6 @@ a { .mobile-cta-btn { flex: 1; min-height: 44px; - border-radius: var(--radius-md); - background: var(--accent); - color: var(--text-on-dark); - font-size: var(--text-md); - font-weight: var(--weight-medium); } .footer-inner { @@ -1502,7 +1756,7 @@ a { font-family: var(--font-mono); font-size: var(--text-lg); font-weight: var(--weight-bold); - color: var(--accent-strong); + color: var(--accent-ink); letter-spacing: 0.5px; user-select: all; } @@ -1512,3 +1766,24 @@ a { color: var(--success); margin: 0; } + +/* ============================================================ + 全局兜底 (DESIGN.md v2.0 §3.0) + ============================================================ */ +button:focus-visible, +a:focus-visible { + outline: none; + box-shadow: var(--focus-ring); +} + +/* 减动效:动画/过渡时长归近零,保留颜色/透明度反馈 */ +@media (prefers-reduced-motion: reduce) { + *, + *::before, + *::after { + animation-duration: 0.01ms !important; + animation-iteration-count: 1 !important; + transition-duration: 0.01ms !important; + scroll-behavior: auto !important; + } +}