feat: 集成 Tailwind CSS v4,替换手写样式为 utility classes
This commit is contained in:
572
web/style.css
572
web/style.css
@@ -1,136 +1,191 @@
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
@import "tailwindcss";
|
||||
|
||||
/* ─── Design Tokens ─── */
|
||||
@theme {
|
||||
--color-bg: #08080d;
|
||||
--color-surface: #111117;
|
||||
--color-surface-hover: #17171e;
|
||||
--color-surface-active: #1c1c25;
|
||||
--color-edge: #1e1e2a;
|
||||
--color-edge-active: #2c2c3e;
|
||||
--color-fg: #eaeaef;
|
||||
--color-fg-secondary: #9e9eb5;
|
||||
--color-fg-dim: #5a5a6e;
|
||||
--color-accent: #6366f1;
|
||||
--color-accent-hover: #818cf8;
|
||||
--color-danger: #f43f5e;
|
||||
--color-success: #34d399;
|
||||
--radius-card: 14px;
|
||||
}
|
||||
|
||||
:root {
|
||||
/* Warm dark palette — subtle indigo undertone */
|
||||
--bg: #08080d;
|
||||
--surface: #111117;
|
||||
--surface-hover: #17171e;
|
||||
--surface-active: #1c1c25;
|
||||
--border: #1e1e2a;
|
||||
--border-active: #2c2c3e;
|
||||
--text: #eaeaef;
|
||||
--text-secondary: #9e9eb5;
|
||||
--text-dim: #5a5a6e;
|
||||
--accent: #6366f1;
|
||||
--accent-hover: #818cf8;
|
||||
--accent-glow: rgba(99, 102, 241, 0.2);
|
||||
--accent-glow-md: rgba(99, 102, 241, 0.35);
|
||||
--accent-glow-lg: rgba(99, 102, 241, 0.08);
|
||||
--danger: #f43f5e;
|
||||
--success: #34d399;
|
||||
--radius: 14px;
|
||||
--radius-sm: 8px;
|
||||
--safe-top: env(safe-area-inset-top, 0px);
|
||||
--safe-bottom: env(safe-area-inset-bottom, 0px);
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
font-family:
|
||||
"SF Pro Display", -apple-system, BlinkMacSystemFont, "PingFang SC",
|
||||
"Hiragino Sans GB", "Microsoft YaHei", sans-serif;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
-webkit-touch-callout: none;
|
||||
user-select: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Subtle ambient glow at top */
|
||||
body::after {
|
||||
content: "";
|
||||
position: fixed;
|
||||
top: -30%;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 600px;
|
||||
height: 600px;
|
||||
background: radial-gradient(
|
||||
circle,
|
||||
rgba(99, 102, 241, 0.04) 0%,
|
||||
transparent 70%
|
||||
);
|
||||
pointer-events: none;
|
||||
z-index: 0;
|
||||
/* ─── Base ─── */
|
||||
@layer base {
|
||||
html,
|
||||
body {
|
||||
font-family:
|
||||
"SF Pro Display", -apple-system, BlinkMacSystemFont, "PingFang SC",
|
||||
"Hiragino Sans GB", "Microsoft YaHei", sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
-webkit-touch-callout: none;
|
||||
}
|
||||
|
||||
body::after {
|
||||
content: "";
|
||||
@apply fixed pointer-events-none z-0;
|
||||
top: -30%;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 600px;
|
||||
height: 600px;
|
||||
background: radial-gradient(
|
||||
circle,
|
||||
rgba(99, 102, 241, 0.04) 0%,
|
||||
transparent 70%
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/* ─── App Container (safe-area padding) ─── */
|
||||
#app {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
max-width: 480px;
|
||||
margin: 0 auto;
|
||||
padding: calc(16px + var(--safe-top)) 20px calc(16px + var(--safe-bottom));
|
||||
}
|
||||
|
||||
/* ─── Header ─── */
|
||||
header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 8px 0 20px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
header h1 {
|
||||
font-size: 22px;
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.03em;
|
||||
}
|
||||
|
||||
.status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
color: var(--text-dim);
|
||||
padding: 5px 12px;
|
||||
border-radius: 20px;
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
transition: all 0.25s ease;
|
||||
}
|
||||
|
||||
.status .dot {
|
||||
width: 7px;
|
||||
height: 7px;
|
||||
border-radius: 50%;
|
||||
background: var(--text-dim);
|
||||
transition: all 0.3s ease;
|
||||
flex-shrink: 0;
|
||||
padding: calc(16px + env(safe-area-inset-top, 0px)) 20px
|
||||
calc(16px + env(safe-area-inset-bottom, 0px));
|
||||
}
|
||||
|
||||
/* ─── Connection Status States ─── */
|
||||
.status.connected {
|
||||
border-color: rgba(52, 211, 153, 0.15);
|
||||
@apply border-success/15;
|
||||
}
|
||||
|
||||
.status.connected .dot {
|
||||
background: var(--success);
|
||||
@apply bg-success;
|
||||
box-shadow: 0 0 6px rgba(52, 211, 153, 0.5);
|
||||
}
|
||||
|
||||
.status.disconnected .dot {
|
||||
background: var(--danger);
|
||||
@apply bg-danger;
|
||||
box-shadow: 0 0 6px rgba(244, 63, 94, 0.4);
|
||||
}
|
||||
|
||||
.status.connecting .dot {
|
||||
background: var(--accent);
|
||||
@apply bg-accent;
|
||||
animation: pulse 1.4s ease-in-out infinite;
|
||||
}
|
||||
|
||||
/* ─── Preview Active State ─── */
|
||||
.preview-box.active {
|
||||
border-color: rgba(99, 102, 241, 0.4);
|
||||
box-shadow:
|
||||
0 0 0 1px rgba(99, 102, 241, 0.2),
|
||||
0 4px 24px -4px rgba(99, 102, 241, 0.15);
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
rgba(99, 102, 241, 0.03) 0%,
|
||||
var(--color-surface) 100%
|
||||
);
|
||||
}
|
||||
|
||||
/* ─── Placeholder Text ─── */
|
||||
#preview-text.placeholder {
|
||||
@apply text-fg-dim;
|
||||
}
|
||||
|
||||
/* ─── Mic Button ─── */
|
||||
#mic-btn {
|
||||
background: linear-gradient(
|
||||
145deg,
|
||||
var(--color-surface-hover),
|
||||
var(--color-surface)
|
||||
);
|
||||
box-shadow:
|
||||
0 2px 12px rgba(0, 0, 0, 0.3),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.04);
|
||||
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
}
|
||||
#mic-btn:disabled {
|
||||
@apply opacity-30 cursor-not-allowed;
|
||||
}
|
||||
#mic-btn:not(:disabled):active,
|
||||
#mic-btn.recording {
|
||||
@apply bg-accent border-accent-hover text-white;
|
||||
transform: scale(1.06);
|
||||
box-shadow:
|
||||
0 0 32px rgba(99, 102, 241, 0.35),
|
||||
0 0 80px rgba(99, 102, 241, 0.2);
|
||||
}
|
||||
#mic-btn.recording {
|
||||
animation: mic-breathe 1.8s ease-in-out infinite;
|
||||
}
|
||||
|
||||
/* ─── Wave Rings ─── */
|
||||
#mic-btn.recording + .mic-rings .ring {
|
||||
animation: ring-expand 2.4s cubic-bezier(0.2, 0, 0.2, 1) infinite;
|
||||
}
|
||||
#mic-btn.recording + .mic-rings .ring:nth-child(2) {
|
||||
animation-delay: 0.8s;
|
||||
}
|
||||
#mic-btn.recording + .mic-rings .ring:nth-child(3) {
|
||||
animation-delay: 1.6s;
|
||||
}
|
||||
|
||||
/* ─── History Items (dynamically created) ─── */
|
||||
#history-list li {
|
||||
@apply bg-surface border border-edge rounded-card cursor-pointer flex items-start gap-3 transition-all duration-150;
|
||||
padding: 14px 16px;
|
||||
margin-bottom: 8px;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
animation: slide-up 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
|
||||
animation-delay: calc(var(--i, 0) * 40ms);
|
||||
}
|
||||
#history-list li:active {
|
||||
@apply bg-surface-active border-edge-active;
|
||||
transform: scale(0.985);
|
||||
}
|
||||
#history-list li .hist-text {
|
||||
@apply flex-1 break-words;
|
||||
}
|
||||
#history-list li .hist-time {
|
||||
@apply text-fg-dim whitespace-nowrap shrink-0;
|
||||
font-size: 11px;
|
||||
padding-top: 2px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
/* ─── Text Button Active State ─── */
|
||||
.text-btn:active {
|
||||
@apply text-danger;
|
||||
background: rgba(244, 63, 94, 0.08);
|
||||
}
|
||||
|
||||
/* ─── Scrollbar ─── */
|
||||
.preview-box::-webkit-scrollbar,
|
||||
#history-list::-webkit-scrollbar {
|
||||
width: 3px;
|
||||
}
|
||||
.preview-box::-webkit-scrollbar-track,
|
||||
#history-list::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
}
|
||||
.preview-box::-webkit-scrollbar-thumb,
|
||||
#history-list::-webkit-scrollbar-thumb {
|
||||
@apply bg-edge;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
/* ─── Toast ─── */
|
||||
.toast {
|
||||
bottom: calc(80px + env(safe-area-inset-bottom, 0px));
|
||||
transform: translateX(-50%) translateY(8px);
|
||||
background: rgba(28, 28, 37, 0.85);
|
||||
backdrop-filter: blur(16px);
|
||||
-webkit-backdrop-filter: blur(16px);
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
|
||||
transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
||||
}
|
||||
.toast.show {
|
||||
@apply opacity-100;
|
||||
transform: translateX(-50%) translateY(0);
|
||||
}
|
||||
|
||||
/* ─── Keyframes ─── */
|
||||
@keyframes pulse {
|
||||
0%,
|
||||
100% {
|
||||
@@ -141,153 +196,21 @@ header h1 {
|
||||
}
|
||||
}
|
||||
|
||||
/* ─── Preview ─── */
|
||||
#preview-section {
|
||||
flex-shrink: 0;
|
||||
padding-bottom: 12px;
|
||||
}
|
||||
|
||||
.preview-box {
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
padding: 16px 18px;
|
||||
min-height: 80px;
|
||||
max-height: 160px;
|
||||
overflow-y: auto;
|
||||
transition:
|
||||
border-color 0.3s ease,
|
||||
box-shadow 0.3s ease,
|
||||
background 0.3s ease;
|
||||
}
|
||||
|
||||
.preview-box.active {
|
||||
border-color: rgba(99, 102, 241, 0.4);
|
||||
box-shadow:
|
||||
0 0 0 1px var(--accent-glow),
|
||||
0 4px 24px -4px rgba(99, 102, 241, 0.15);
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
rgba(99, 102, 241, 0.03) 0%,
|
||||
var(--surface) 100%
|
||||
);
|
||||
}
|
||||
|
||||
#preview-text {
|
||||
font-size: 16px;
|
||||
line-height: 1.6;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
#preview-text.placeholder {
|
||||
color: var(--text-dim);
|
||||
}
|
||||
|
||||
/* ─── Mic Button ─── */
|
||||
#mic-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 20px 0 16px;
|
||||
flex-shrink: 0;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.mic-wrapper {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
touch-action: none;
|
||||
}
|
||||
|
||||
#mic-btn {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
width: 96px;
|
||||
height: 96px;
|
||||
border-radius: 50%;
|
||||
border: 2px solid var(--border);
|
||||
background: linear-gradient(145deg, var(--surface-hover), var(--surface));
|
||||
color: var(--text-secondary);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
-webkit-user-select: none;
|
||||
touch-action: none;
|
||||
box-shadow:
|
||||
0 2px 12px rgba(0, 0, 0, 0.3),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.04);
|
||||
}
|
||||
|
||||
#mic-btn svg {
|
||||
transition: transform 0.2s ease;
|
||||
}
|
||||
|
||||
#mic-btn:disabled {
|
||||
opacity: 0.3;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
#mic-btn:not(:disabled):active,
|
||||
#mic-btn.recording {
|
||||
background: var(--accent);
|
||||
border-color: var(--accent-hover);
|
||||
color: #fff;
|
||||
transform: scale(1.06);
|
||||
box-shadow:
|
||||
0 0 32px var(--accent-glow-md),
|
||||
0 0 80px var(--accent-glow);
|
||||
}
|
||||
|
||||
#mic-btn.recording {
|
||||
animation: mic-breathe 1.8s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes mic-breathe {
|
||||
0%,
|
||||
100% {
|
||||
box-shadow:
|
||||
0 0 32px var(--accent-glow-md),
|
||||
0 0 80px var(--accent-glow);
|
||||
0 0 32px rgba(99, 102, 241, 0.35),
|
||||
0 0 80px rgba(99, 102, 241, 0.2);
|
||||
}
|
||||
50% {
|
||||
box-shadow:
|
||||
0 0 48px var(--accent-glow-md),
|
||||
0 0 120px var(--accent-glow),
|
||||
0 0 200px var(--accent-glow-lg);
|
||||
0 0 48px rgba(99, 102, 241, 0.35),
|
||||
0 0 120px rgba(99, 102, 241, 0.2),
|
||||
0 0 200px rgba(99, 102, 241, 0.08);
|
||||
}
|
||||
}
|
||||
|
||||
/* Wave rings — radiate outward when recording */
|
||||
.mic-rings {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.mic-rings .ring {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
border-radius: 50%;
|
||||
border: 1.5px solid var(--accent);
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
#mic-btn.recording + .mic-rings .ring {
|
||||
animation: ring-expand 2.4s cubic-bezier(0.2, 0, 0.2, 1) infinite;
|
||||
}
|
||||
|
||||
#mic-btn.recording + .mic-rings .ring:nth-child(2) {
|
||||
animation-delay: 0.8s;
|
||||
}
|
||||
|
||||
#mic-btn.recording + .mic-rings .ring:nth-child(3) {
|
||||
animation-delay: 1.6s;
|
||||
}
|
||||
|
||||
@keyframes ring-expand {
|
||||
0% {
|
||||
transform: scale(1);
|
||||
@@ -299,99 +222,6 @@ header h1 {
|
||||
}
|
||||
}
|
||||
|
||||
.mic-hint {
|
||||
font-size: 13px;
|
||||
color: var(--text-dim);
|
||||
letter-spacing: 0.01em;
|
||||
transition: color 0.3s ease;
|
||||
}
|
||||
|
||||
/* ─── History ─── */
|
||||
#history-section {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.history-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-bottom: 10px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.history-header h2 {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: var(--text-dim);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.06em;
|
||||
}
|
||||
|
||||
.text-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--text-dim);
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
padding: 4px 10px;
|
||||
border-radius: var(--radius-sm);
|
||||
transition: all 0.15s ease;
|
||||
}
|
||||
|
||||
.text-btn:active {
|
||||
color: var(--danger);
|
||||
background: rgba(244, 63, 94, 0.08);
|
||||
}
|
||||
|
||||
#history-list {
|
||||
list-style: none;
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
#history-list li {
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
padding: 14px 16px;
|
||||
margin-bottom: 8px;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s ease;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
animation: slide-up 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
|
||||
animation-delay: calc(var(--i, 0) * 40ms);
|
||||
}
|
||||
|
||||
#history-list li:active {
|
||||
background: var(--surface-active);
|
||||
border-color: var(--border-active);
|
||||
transform: scale(0.985);
|
||||
}
|
||||
|
||||
#history-list li .hist-text {
|
||||
flex: 1;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
#history-list li .hist-time {
|
||||
font-size: 11px;
|
||||
color: var(--text-dim);
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
padding-top: 2px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
@keyframes slide-up {
|
||||
from {
|
||||
opacity: 0;
|
||||
@@ -402,57 +232,3 @@ header h1 {
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
#history-empty {
|
||||
text-align: center;
|
||||
padding: 40px 0;
|
||||
}
|
||||
|
||||
.placeholder {
|
||||
color: var(--text-dim);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
/* ─── Scrollbar ─── */
|
||||
.preview-box::-webkit-scrollbar,
|
||||
#history-list::-webkit-scrollbar {
|
||||
width: 3px;
|
||||
}
|
||||
|
||||
.preview-box::-webkit-scrollbar-track,
|
||||
#history-list::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.preview-box::-webkit-scrollbar-thumb,
|
||||
#history-list::-webkit-scrollbar-thumb {
|
||||
background: var(--border);
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
/* ─── Toast ─── */
|
||||
.toast {
|
||||
position: fixed;
|
||||
bottom: calc(80px + var(--safe-bottom, 0px));
|
||||
left: 50%;
|
||||
transform: translateX(-50%) translateY(8px);
|
||||
background: rgba(28, 28, 37, 0.85);
|
||||
color: var(--text);
|
||||
padding: 10px 22px;
|
||||
border-radius: 24px;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
z-index: 999;
|
||||
opacity: 0;
|
||||
transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
||||
pointer-events: none;
|
||||
border: 1px solid var(--border);
|
||||
backdrop-filter: blur(16px);
|
||||
-webkit-backdrop-filter: blur(16px);
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
.toast.show {
|
||||
opacity: 1;
|
||||
transform: translateX(-50%) translateY(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user