Files
antiwear-web/frontend/styles/main.css
ZF sun f0f2ce550a refactor(frontend): 移除缩放逻辑并调整SDK容器样式
将SDK容器的缩放计算逻辑移除,改为固定不缩放
调整SDK容器的CSS样式,使用绝对定位和vh单位
2026-04-30 10:28:53 +08:00

637 lines
13 KiB
CSS

/* ===== CSS 变量定义 ===== */
:root {
--primary-color: #2563eb;
--primary-dark: #1d4ed8;
--primary-light: #3b82f6;
--primary-gradient: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
--success-color: #10b981;
--warning-color: #f59e0b;
--danger-color: #ef4444;
--info-color: #06b6d4;
--bg-primary: #0f172a;
--bg-secondary: #1e293b;
--bg-tertiary: #334155;
--text-primary: #f8fafc;
--text-secondary: #94a3b8;
--text-muted: #64748b;
--border-color: #475569;
--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
--shadow-glow: 0 0 20px rgba(37, 99, 235, 0.3);
--spacing-xs: 0.25rem;
--spacing-sm: 0.5rem;
--spacing-md: 1rem;
--spacing-lg: 1.5rem;
--spacing-xl: 2rem;
--radius-sm: 0.375rem;
--radius-md: 0.5rem;
--radius-lg: 0.75rem;
--radius-xl: 1rem;
--font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
/* ===== 基础样式重置 ===== */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: var(--font-family);
background: var(--bg-primary);
color: var(--text-primary);
min-height: 100vh;
overflow: hidden;
}
/* ===== 数字人全视口容器 ===== */
.digital-human-box {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: var(--bg-primary);
display: flex;
align-items: center;
justify-content: center;
z-index: 1;
}
.digital-human-box.active {
box-shadow: inset 0 0 50px rgba(37, 99, 235, 0.1);
}
.digital-human-box::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background:
radial-gradient(circle at 20% 80%, rgba(37, 99, 235, 0.05) 0%, transparent 50%),
radial-gradient(circle at 80% 20%, rgba(6, 182, 212, 0.05) 0%, transparent 50%);
pointer-events: none;
z-index: 0;
}
.placeholder {
text-align: center;
color: var(--text-muted);
z-index: 1;
}
.placeholder-icon {
font-size: 5rem;
display: block;
margin-bottom: var(--spacing-md);
opacity: 0.5;
animation: float 3s ease-in-out infinite;
}
@keyframes float {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-10px); }
}
.placeholder p {
font-size: 1rem;
opacity: 0.7;
}
.fullscreen-exit-hint {
position: absolute;
bottom: var(--spacing-lg);
left: 50%;
transform: translateX(-50%);
background: rgba(30, 41, 59, 0.8);
backdrop-filter: blur(10px);
padding: var(--spacing-sm) var(--spacing-md);
border-radius: var(--radius-md);
color: var(--text-secondary);
font-size: 0.875rem;
opacity: 0;
transition: opacity 0.3s ease;
pointer-events: none;
z-index: 10;
}
.digital-human-box.fullscreen:hover .fullscreen-exit-hint {
opacity: 1;
}
/* ===== 浮动控制栏 ===== */
.floating-toolbar {
position: fixed;
bottom: var(--spacing-xl);
right: var(--spacing-xl);
display: flex;
flex-direction: column;
gap: var(--spacing-sm);
z-index: 1000;
}
.toolbar-btn {
width: 50px;
height: 50px;
border-radius: var(--radius-lg);
background: var(--bg-secondary);
border: 1px solid var(--border-color);
color: var(--text-primary);
font-size: 1.5rem;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease;
box-shadow: var(--shadow-md);
}
.toolbar-btn:hover {
background: var(--primary-color);
border-color: var(--primary-color);
transform: scale(1.1);
box-shadow: var(--shadow-glow);
}
.toolbar-btn:active {
transform: scale(0.95);
}
.toolbar-btn.active {
background: var(--primary-color);
border-color: var(--primary-color);
}
/* ===== 浮动面板通用样式 ===== */
.floating-panel {
position: fixed;
background: var(--bg-secondary);
border: 1px solid var(--border-color);
border-radius: var(--radius-xl);
box-shadow: var(--shadow-lg);
z-index: 999;
display: none;
flex-direction: column;
max-height: 80vh;
overflow: hidden;
animation: panelSlideIn 0.2s ease-out;
}
@keyframes panelSlideIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.floating-panel.visible {
display: flex;
}
.panel-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: var(--spacing-md) var(--spacing-lg);
border-bottom: 1px solid var(--border-color);
background: var(--bg-tertiary);
}
.panel-header h2 {
font-size: 1rem;
font-weight: 600;
color: var(--text-primary);
margin: 0;
}
.panel-close {
width: 30px;
height: 30px;
border-radius: var(--radius-md);
background: transparent;
border: none;
color: var(--text-secondary);
font-size: 1.5rem;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease;
}
.panel-close:hover {
background: var(--danger-color);
color: white;
}
.panel-content {
padding: var(--spacing-lg);
overflow-y: auto;
flex: 1;
}
/* ===== 连接配置面板 ===== */
.config-panel {
bottom: calc(var(--spacing-xl) + 60px);
right: var(--spacing-xl);
width: 360px;
max-height: 70vh;
}
.config-section {
margin-bottom: var(--spacing-lg);
padding-bottom: var(--spacing-lg);
border-bottom: 1px solid var(--border-color);
}
.config-section:last-of-type {
border-bottom: none;
margin-bottom: 0;
}
.config-section h3 {
font-size: 0.875rem;
font-weight: 600;
color: var(--primary-light);
margin-bottom: var(--spacing-md);
text-transform: uppercase;
letter-spacing: 0.05em;
}
.form-group {
margin-bottom: var(--spacing-md);
}
.form-group label {
display: block;
margin-bottom: var(--spacing-xs);
color: var(--text-secondary);
font-size: 0.875rem;
font-weight: 500;
}
.form-group input {
width: 100%;
padding: var(--spacing-sm) var(--spacing-md);
background: var(--bg-tertiary);
border: 1px solid var(--border-color);
border-radius: var(--radius-md);
color: var(--text-primary);
font-size: 0.875rem;
transition: all 0.2s ease;
}
.form-group input:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}
.form-group input::placeholder {
color: var(--text-muted);
}
.form-group input[readonly] {
background: var(--bg-primary);
cursor: default;
}
.input-with-button {
display: flex;
gap: var(--spacing-sm);
}
.input-with-button input {
flex: 1;
}
.field-hint {
display: block;
margin-top: var(--spacing-xs);
color: var(--text-muted);
font-size: 0.75rem;
}
.form-actions {
display: flex;
gap: var(--spacing-sm);
margin-top: var(--spacing-lg);
}
/* ===== 对话控制面板 ===== */
/* ===== 日志面板 ===== */
.log-panel {
bottom: calc(var(--spacing-xl) + 60px);
right: var(--spacing-xl);
width: 450px;
max-height: 60vh;
}
.log-toolbar {
display: flex;
gap: var(--spacing-sm);
align-items: center;
}
.log-toolbar select {
padding: var(--spacing-xs) var(--spacing-sm);
background: var(--bg-tertiary);
border: 1px solid var(--border-color);
border-radius: var(--radius-md);
color: var(--text-primary);
font-size: 0.875rem;
}
.log-container {
overflow-y: auto;
background: var(--bg-primary);
border-radius: var(--radius-md);
padding: var(--spacing-md);
font-family: 'Consolas', 'Monaco', monospace;
font-size: 0.8125rem;
line-height: 1.5;
max-height: 400px;
}
.log-entry {
padding: var(--spacing-xs) 0;
border-bottom: 1px solid var(--bg-tertiary);
display: flex;
gap: var(--spacing-sm);
animation: slideIn 0.2s ease-out;
}
.log-entry:last-child {
border-bottom: none;
}
.log-time {
color: var(--text-muted);
white-space: nowrap;
}
.log-level {
font-weight: 600;
min-width: 50px;
}
.log-level.debug {
color: var(--text-muted);
}
.log-level.info {
color: var(--info-color);
}
.log-level.warn {
color: var(--warning-color);
}
.log-level.error {
color: var(--danger-color);
}
.log-message {
color: var(--text-primary);
word-break: break-all;
}
/* ===== 状态栏 ===== */
.status-bar-floating {
position: fixed;
top: var(--spacing-lg);
left: var(--spacing-lg);
display: flex;
align-items: center;
gap: var(--spacing-md);
z-index: 10000;
background: var(--bg-secondary);
padding: var(--spacing-sm) var(--spacing-md);
border-radius: var(--radius-lg);
border: 1px solid var(--border-color);
box-shadow: var(--shadow-md);
backdrop-filter: blur(10px);
}
.status {
padding: var(--spacing-xs) var(--spacing-md);
border-radius: var(--radius-full);
font-size: 0.875rem;
font-weight: 500;
display: flex;
align-items: center;
gap: var(--spacing-xs);
}
.status::before {
content: '';
width: 8px;
height: 8px;
border-radius: 50%;
background: currentColor;
}
.status.connected {
background: rgba(16, 185, 129, 0.2);
color: var(--success-color);
}
.status.disconnected {
background: rgba(239, 68, 68, 0.2);
color: var(--danger-color);
}
.version {
color: var(--text-muted);
font-size: 0.875rem;
}
/* ===== 按钮样式 ===== */
.btn {
padding: var(--spacing-sm) var(--spacing-md);
border: none;
border-radius: var(--radius-md);
font-size: 0.875rem;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease;
display: inline-flex;
align-items: center;
justify-content: center;
gap: var(--spacing-xs);
white-space: nowrap;
}
.btn:hover:not(:disabled) {
transform: translateY(-1px);
box-shadow: var(--shadow-md);
}
.btn:active:not(:disabled) {
transform: translateY(0);
}
.btn:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.btn-primary {
background: var(--primary-gradient);
color: white;
}
.btn-primary:hover:not(:disabled) {
box-shadow: var(--shadow-glow);
}
.btn-success {
background: linear-gradient(135deg, #10b981 0%, #059669 100%);
color: white;
}
.btn-warning {
background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
color: white;
}
.btn-danger {
background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
color: white;
}
.btn-info {
background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
color: white;
}
.btn-secondary {
background: var(--bg-tertiary);
color: var(--text-primary);
border: 1px solid var(--border-color);
}
.btn-secondary:hover:not(:disabled) {
background: var(--border-color);
}
.btn-small {
padding: var(--spacing-xs) var(--spacing-sm);
font-size: 0.75rem;
}
/* ===== 全屏模式 ===== */
.digital-human-box.fullscreen {
z-index: 9999 !important;
}
.digital-human-box.fullscreen .fullscreen-exit-hint {
opacity: 1;
}
/* ===== SDK 响应式缩放 ===== */
.digital-human-box .sdk-scaling-wrapper {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
z-index: 1;
}
.digital-human-box .sdk-scaling-wrapper .sdk-inner {
position: absolute;
top: 0;
left: 50%;
height: 100%;
transform: translateX(-50%);
transform-origin: center center;
}
.digital-human-box .sdk-scaling-wrapper .sdk-inner .digital-intelligent-interaction {
width: 177.78vh !important;
height: 100vh !important;
}
/* ===== 覆盖 SDK 字体大小 ===== */
.digital-intelligent-interaction {
font-size: 14px !important;
}
.digital-intelligent-interaction .ai-chat-btn .ai-chat-btn-content {
font-size: 16px !important;
}
.digital-intelligent-interaction .message-item .rich-text-card .content {
font-size: 16px !important;
line-height: 24px !important;
}
.digital-intelligent-interaction .stop-chat-btn.normal .stop-chat-btn-content {
font-size: 16px !important;
}
.digital-intelligent-interaction .toast-container .toast-content .toast-text {
font-size: 12px !important;
}
/* ===== 滚动条样式 ===== */
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar-track {
background: var(--bg-tertiary);
border-radius: var(--radius-md);
}
::-webkit-scrollbar-thumb {
background: var(--border-color);
border-radius: var(--radius-md);
}
::-webkit-scrollbar-thumb:hover {
background: var(--text-muted);
}
/* ===== 动画效果 ===== */
@keyframes pulse {
0%, 100% {
opacity: 1;
}
50% {
opacity: 0.5;
}
}
.pulse {
animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes slideIn {
from {
opacity: 0;
transform: translateY(-10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}