Files
Thing/src/style.css
T
2026-09-22 19:10:16 +08:00

520 lines
16 KiB
CSS

@import "tailwindcss";
@import "tw-animate-css";
@custom-variant dark (&:is(.dark *));
/* =============================================================================
Thing Design Tokens
规范见仓库根目录 UI_DESIGN_SYSTEM.md
本文件是 Token 的唯一事实来源。组件内禁止出现 hex / rgb / oklch 字面量,
也禁止使用 Tailwind 原生色阶(bg-blue-500 / text-emerald-700 等)。
值统一使用 hex,便于与设计稿、设计系统文档逐值核对。
========================================================================== */
@theme inline {
--font-heading: var(--font-sans);
/* ---------- 表面 ---------- */
--color-canvas: var(--canvas);
--color-subtle: var(--subtle);
--color-hover: var(--hover);
--color-active: var(--active);
/* ---------- 描边扩展(border 为 shadcn 既有映射,见下方)---------- */
--color-border-strong: var(--border-strong);
--color-divider: var(--divider);
/* ---------- 文字层级 ---------- */
--color-fg-secondary: var(--fg-secondary);
--color-fg-disabled: var(--fg-disabled);
/* ---------- 强调 ---------- */
--color-primary-hover: var(--primary-hover);
--color-primary-active: var(--primary-active);
--color-primary-soft: var(--primary-soft);
--color-primary-soft-text: var(--primary-soft-text);
/* ---------- 语义状态(每个状态三件套:实心 / 浅底 / 浅底文字)---------- */
--color-success: var(--success);
--color-success-soft: var(--success-soft);
--color-success-text: var(--success-text);
--color-warning: var(--warning);
--color-warning-soft: var(--warning-soft);
--color-warning-text: var(--warning-text);
--color-danger: var(--danger);
--color-danger-soft: var(--danger-soft);
--color-danger-text: var(--danger-text);
--color-info: var(--info);
--color-info-soft: var(--info-soft);
--color-info-text: var(--info-text);
--color-neutral: var(--neutral);
--color-neutral-soft: var(--neutral-soft);
--color-neutral-text: var(--neutral-text);
/* ---------- 数据方向(与状态语义解耦)---------- */
--color-data-down: var(--data-down);
--color-data-up: var(--data-up);
/* ---------- 阴影 ---------- */
--shadow-popover: var(--shadow-popover);
--shadow-dialog: var(--shadow-dialog);
--shadow-card: var(--shadow-card);
/* ---------- shadcn 既有映射(保持兼容,勿删)---------- */
--color-sidebar-ring: var(--sidebar-ring);
--color-sidebar-border: var(--sidebar-border);
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
--color-sidebar-accent: var(--sidebar-accent);
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
--color-sidebar-primary: var(--sidebar-primary);
--color-sidebar-foreground: var(--sidebar-foreground);
--color-sidebar: var(--sidebar);
--color-chart-5: var(--chart-5);
--color-chart-4: var(--chart-4);
--color-chart-3: var(--chart-3);
--color-chart-2: var(--chart-2);
--color-chart-1: var(--chart-1);
--color-ring: var(--ring);
--color-input: var(--input);
--color-border: var(--border);
--color-destructive: var(--destructive);
--color-accent-foreground: var(--accent-foreground);
--color-accent: var(--accent);
--color-muted-foreground: var(--muted-foreground);
--color-muted: var(--muted);
--color-secondary-foreground: var(--secondary-foreground);
--color-secondary: var(--secondary);
--color-primary-foreground: var(--primary-foreground);
--color-primary: var(--primary);
--color-popover-foreground: var(--popover-foreground);
--color-popover: var(--popover);
--color-card-foreground: var(--card-foreground);
--color-card: var(--card);
--color-foreground: var(--foreground);
--color-background: var(--background);
--radius-xs: 4px;
--radius-sm: 6px;
--radius-md: 8px;
--radius-lg: 12px;
--radius-xl: 16px;
}
/* ---------------------------------------------------------------------------
浅色模式
------------------------------------------------------------------------ */
:root {
/* 字体:只用系统字体栈。桌面应用不引用外部字体 CDN(离线会阻塞/静默失败) */
--font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI Variable Text', 'Segoe UI',
'Microsoft YaHei UI', 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', 'Noto Sans SC',
'WenQuanYi Micro Hei', sans-serif;
--font-mono: 'Cascadia Code', 'JetBrains Mono', Consolas, 'Courier New', monospace;
/* ── 表面 ─────────────────────────────────────────────────────────── */
--canvas: #f5f5f7; /* 应用底 / 模块内容区背景 */
--background: #ffffff; /* shadcn 基准面 */
--card: #ffffff; /* 卡片 / 面板 */
--popover: #ffffff; /* 浮层 */
--subtle: #f0f0f2; /* 次级填充:搜索框底、分段控件槽、代码块 */
--hover: #ebebed; /* 中性 hover 底色 */
--active: #e4e4e7; /* 中性 active 底色 */
/* ── 描边 ─────────────────────────────────────────────────────────── */
--border: #e4e4e7; /* 卡片外框、输入框 */
--border-strong: #d1d1d6;
--divider: #f0f0f2; /* 卡片内部分隔线 */
--input: #e4e4e7;
/* ── 文字 ─────────────────────────────────────────────────────────── */
--foreground: #1d1d1f; /* 主文字:标题、正文、数值 */
--fg-secondary: #55555c; /* 次文字:键名、标签说明 */
--muted-foreground: #8a8a90; /* 辅助:占位符、规格说明 */
--fg-disabled: #b4b4ba; /* 禁用 */
/* ── 强调 ─────────────────────────────────────────────────────────── */
--primary: #0066cc;
--primary-hover: #0055b3; /* hover 变深,不用透明度方案 */
--primary-active: #004a9e;
--primary-foreground: #ffffff;
--primary-soft: #e8f1fc; /* 选中底 / 图标按钮 hover 底 */
--primary-soft-text: #004f9e; /* 上述底上的文字 */
--ring: #0071e3;
/* ── 语义状态:实心 / 浅底 / 浅底文字 ─────────────────────────────── */
--success: #0f7b4f;
--success-soft: #e7f5ee;
--success-text: #0b5c3b;
--warning: #a96b00;
--warning-soft: #fdf4e4;
--warning-text: #7d4f00;
--danger: #c7362f;
--danger-soft: #fdecea;
--danger-text: #9a2620;
--info: #0066cc;
--info-soft: #e8f1fc;
--info-text: #004f9e;
--neutral: #8a8a90;
--neutral-soft: #f0f0f2;
--neutral-text: #55555c;
/* shadcn 的 destructive 指向 danger,保持组件兼容 */
--destructive: #c7362f;
/* ── 数据方向 ─────────────────────────────────────────────────────── */
--data-down: #0f7b4f;
--data-up: #c7362f;
/* ── shadcn 既有别名(值收敛到上面的体系)───────────────────────── */
--secondary: #f0f0f2;
--secondary-foreground: #1d1d1f;
--muted: #f0f0f2;
/* accent 是 shadcn 的通用 hover 底色。必须比旧值 #f5f5f5 深 ——
旧值在纯白背景上只深 4%,hover 完全看不出来 */
--accent: #ebebed;
--accent-foreground: #1d1d1f;
--popover-foreground: #1d1d1f;
--card-foreground: #1d1d1f;
/* ── 圆角 ─────────────────────────────────────────────────────────── */
--radius: 12px;
--radius-xs: 4px;
--radius-sm: 6px;
--radius-md: 8px;
--radius-lg: 12px;
--radius-xl: 16px;
/* ── 阴影:只属于浮层,卡片靠描边(见规范 P7)──────────────────── */
--shadow-card: 0 1px 2px rgba(0, 0, 0, 0.05);
--shadow-popover: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.1);
--shadow-dialog: 0 4px 12px rgba(0, 0, 0, 0.08), 0 20px 48px rgba(0, 0, 0, 0.16);
/* ── 图表 ─────────────────────────────────────────────────────────── */
--chart-1: #0066cc;
--chart-2: #0f7b4f;
--chart-3: #a96b00;
--chart-4: #7a5af8;
--chart-5: #c7362f;
/* ── 侧边栏 ───────────────────────────────────────────────────────── */
--sidebar: #ffffff;
--sidebar-foreground: #1d1d1f;
--sidebar-primary: #0066cc;
--sidebar-primary-foreground: #ffffff;
--sidebar-accent: #ebebed;
--sidebar-accent-foreground: #1d1d1f;
--sidebar-border: #e4e4e7;
--sidebar-ring: #0071e3;
}
/* ---------------------------------------------------------------------------
深色模式
深色不是浅色的机械反相:强调色换成亮蓝(#0066cc 在深底上对比度不足),
状态色整体提亮,浅底改为低明度同色调。
------------------------------------------------------------------------ */
.dark {
--canvas: #16161a;
--background: #16161a;
--card: #1e1e22;
--popover: #1e1e22;
--subtle: #26262b;
--hover: #2c2c32;
--active: #33333a;
--border: #2e2e34;
--border-strong: #3a3a42;
--divider: #26262b;
--input: #2e2e34;
--foreground: #f5f5f7;
--fg-secondary: #a8a8b0;
--muted-foreground: #7a7a82;
--fg-disabled: #55555c;
--primary: #2997ff;
--primary-hover: #4aa8ff;
--primary-active: #1a85e8;
--primary-foreground: #ffffff;
--primary-soft: #14304d;
--primary-soft-text: #7fc0ff;
--ring: #2997ff;
--success: #3dc77f;
--success-soft: #12301f;
--success-text: #7fe0ab;
--warning: #e0a83c;
--warning-soft: #33260e;
--warning-text: #f0c976;
--danger: #ff6b60;
--danger-soft: #3a1a18;
--danger-text: #ff9e96;
--info: #2997ff;
--info-soft: #14304d;
--info-text: #7fc0ff;
--neutral: #7a7a82;
--neutral-soft: #26262b;
--neutral-text: #a8a8b0;
--destructive: #ff6b60;
--data-down: #3dc77f;
--data-up: #ff6b60;
--secondary: #26262b;
--secondary-foreground: #f5f5f7;
--muted: #26262b;
--accent: #2c2c32;
--accent-foreground: #f5f5f7;
--popover-foreground: #f5f5f7;
--card-foreground: #f5f5f7;
--shadow-card: 0 1px 2px rgba(0, 0, 0, 0.1);
--shadow-popover: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.5);
--shadow-dialog: 0 4px 12px rgba(0, 0, 0, 0.45), 0 20px 48px rgba(0, 0, 0, 0.6);
--chart-1: #2997ff;
--chart-2: #3dc77f;
--chart-3: #e0a83c;
--chart-4: #9b8afb;
--chart-5: #ff6b60;
--sidebar: #1e1e22;
--sidebar-foreground: #f5f5f7;
--sidebar-primary: #2997ff;
--sidebar-primary-foreground: #ffffff;
--sidebar-accent: #2c2c32;
--sidebar-accent-foreground: #f5f5f7;
--sidebar-border: #2e2e34;
--sidebar-ring: #2997ff;
}
/* ---------------------------------------------------------------------------
窗口效果
Tauri 的 mica / acrylic 由系统合成,Web 层保持透明;
normal 模式给出不透明底以免透出桌面。
------------------------------------------------------------------------ */
.effect-mica,
.dark.effect-mica,
.effect-acrylic,
.dark.effect-acrylic {
--effect-bg: transparent;
--effect-blur: none;
}
.effect-normal {
--effect-bg: #ffffff;
--effect-blur: none;
}
.dark.effect-normal {
--effect-bg: #0b111f;
}
@layer base {
* {
@apply border-border outline-ring/50;
}
html,
body {
background: transparent !important;
@apply text-foreground antialiased;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
/* 数值对齐:速率、版本号、计数刷新时不跳动 */
font-feature-settings: 'tnum', 'lnum';
}
body {
@apply bg-background text-foreground;
}
}
/* 桌面应用体验:默认禁止文本选中(按钮/下拉框/标题等控件文字不可拖动选择),
输入框、文本域、可编辑区域仍允许选择/复制 */
html,
body,
#app {
user-select: none;
-webkit-user-select: none;
}
input,
textarea,
[contenteditable='true'] {
user-select: text;
-webkit-user-select: text;
}
#app {
width: 100%;
height: 100vh;
overflow: hidden;
background: transparent;
@apply antialiased;
}
/* 确保 Sonner toast 始终在最上层 */
[data-sonner-toaster] {
z-index: 99999 !important;
}
/* 进度条 indeterminate 动画(无 Content-Length 时使用) */
@keyframes indeterminate {
0% {
left: -33%;
}
100% {
left: 100%;
}
}
/* 模块 Tab 内容切换动画(全局,所有模块通用) */
.tab-animate {
animation: tabFadeSlide 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}
@keyframes tabFadeSlide {
from {
opacity: 0;
transform: translateY(6px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* 快捷键录入器(全局,截图/剪切板等模块共用) */
.hotkey-recorder {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 120px;
height: 36px;
padding: 0 12px;
border-radius: var(--radius-md);
border: 1px solid var(--input);
background-color: var(--card);
font-size: 0.8125rem;
color: var(--foreground);
cursor: pointer;
user-select: none;
outline: none;
transition:
border-color 0.15s,
box-shadow 0.15s;
}
.hotkey-recorder:hover {
border-color: var(--border-strong);
}
.hotkey-recorder:focus-visible {
border-color: var(--ring);
box-shadow: 0 0 0 2px color-mix(in srgb, var(--ring) 40%, transparent);
}
.hotkey-recorder.recording {
border-color: var(--primary);
box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent);
animation: recordPulse 1.2s ease-in-out infinite;
}
@keyframes recordPulse {
0%,
100% {
opacity: 1;
}
50% {
opacity: 0.6;
}
}
/* Tab 选中下划线 —— ModuleShell 与 shadcn Tabs 共用同一套实现。
用下划线而不是实心色块:实心色是「主操作」的语义,Tab 占用它会让一屏出现两个重点。 */
.tab-underline::after {
content: '';
position: absolute;
left: 12px;
right: 12px;
bottom: 0;
height: 2px;
border-radius: 9999px;
background: var(--primary);
opacity: 0;
transition: opacity 0.15s ease;
}
.tab-underline[data-state='active']::after,
.tab-underline[aria-selected='true']::after {
opacity: 1;
}
/* 图标描边统一 1.75 —— lucide 默认 2,在 13px 正文旁边偏粗。
全局设置比逐组件写 :stroke-width 更可靠(组件里忘记写就会不一致) */
.lucide {
stroke-width: 1.75;
}
/* 状态点呼吸动效:仅用于"运行中/连接中"这类持续态,静态状态不要加 */
@keyframes statusPulse {
0%,
100% {
opacity: 1;
}
50% {
opacity: 0.45;
}
}
.status-dot-pulse {
animation: statusPulse 1.8s ease-in-out infinite;
}
/* 音乐:正在播放的跳动均衡器指示(列表行与播放队列共用) */
.music-eq {
display: inline-flex;
align-items: flex-end;
gap: 2px;
height: 12px;
}
.music-eq > i {
display: block;
width: 2.5px;
border-radius: 1px;
background: var(--primary);
animation: musicEqBounce 0.9s ease-in-out infinite;
}
.music-eq > i:nth-child(1) {
height: 6px;
animation-delay: -0.2s;
}
.music-eq > i:nth-child(2) {
height: 12px;
animation-delay: -0.5s;
}
.music-eq > i:nth-child(3) {
height: 8px;
animation-delay: -0.35s;
}
.music-eq.is-paused > i {
animation-play-state: paused;
}
@keyframes musicEqBounce {
0%,
100% {
transform: scaleY(0.45);
}
50% {
transform: scaleY(1);
}
}
@media (prefers-reduced-motion: reduce) {
.music-eq > i {
animation: none;
}
.tab-animate {
animation: none;
}
.hotkey-recorder.recording {
animation: none;
}
.status-dot-pulse {
animation: none;
}
}