ASR-demo/realtime_asr_optimization_demo/static/style.css

806 lines
13 KiB
CSS
Raw Normal View History

2026-09-10 05:47:09 +00:00
/* ===== Reset & Base ===== */
*,
*::before,
*::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
background: #f0f2f5;
color: #1a1a2e;
line-height: 1.6;
min-height: 100vh;
}
/* ===== Two-Column Layout ===== */
.layout {
display: flex;
height: 100vh;
overflow: hidden;
}
.panel-left {
width: 340px;
min-width: 300px;
flex-shrink: 0;
padding: 20px 16px;
overflow-y: auto;
border-right: 1px solid #e5e5e5;
background: #fff;
}
.panel-right {
flex: 1;
padding: 20px 20px;
overflow: hidden;
display: flex;
flex-direction: column;
}
/* ===== Header ===== */
header {
text-align: center;
margin-bottom: 20px;
}
header h1 {
font-size: 22px;
font-weight: 700;
color: #1a1a2e;
}
.subtitle {
color: #666;
font-size: 13px;
margin-top: 2px;
}
/* ===== Card ===== */
.card {
background: #fff;
border-radius: 10px;
padding: 16px 18px;
margin-bottom: 14px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.panel-left .card {
background: #f9fafb;
}
.card h2 {
font-size: 14px;
font-weight: 600;
color: #333;
margin-bottom: 12px;
padding-bottom: 6px;
border-bottom: 1px solid #eee;
}
/* ===== Collapsible Card Header ===== */
.card-header-collapsible {
display: flex;
align-items: center;
justify-content: space-between;
cursor: pointer;
user-select: none;
padding-bottom: 0;
}
.card-header-collapsible h2 {
margin-bottom: 0;
padding-bottom: 0;
border-bottom: none;
}
.collapse-arrow {
font-size: 11px;
color: #999;
transition: transform 0.2s;
}
.collapse-arrow.expanded {
color: #4a7dff;
}
.advanced-params-body {
margin-top: 12px;
padding-top: 10px;
border-top: 1px solid #eee;
}
/* ===== Section Divider ===== */
.section-divider {
border-top: 1px solid #eee;
margin: 12px 0;
}
/* ===== Form (left panel) ===== */
.form-stack {
display: flex;
flex-direction: column;
gap: 12px;
}
.form-row {
display: flex;
gap: 16px;
}
.form-row .form-group {
flex: 1;
}
.form-row-3 {
display: flex;
gap: 10px;
}
.form-row-3 .form-group {
flex: 1;
min-width: 0;
}
.form-group label:first-child {
display: block;
font-size: 12px;
font-weight: 500;
color: #555;
margin-bottom: 4px;
}
.hint {
color: #999;
font-weight: 400;
}
select,
input[type="text"] {
width: 100%;
padding: 7px 10px;
border: 1px solid #d9d9d9;
border-radius: 6px;
font-size: 13px;
outline: none;
transition: border-color 0.2s;
}
select:focus,
input[type="text"]:focus {
border-color: #4a7dff;
box-shadow: 0 0 0 2px rgba(74, 125, 255, 0.15);
}
input[type="text"][readonly] {
background: #f7f8fa;
color: #666;
cursor: default;
}
input[type="text"][readonly]:focus {
border-color: #d9d9d9;
box-shadow: none;
}
/* ===== Toggle Switch ===== */
.toggle {
display: inline-flex;
align-items: center;
cursor: pointer;
gap: 6px;
user-select: none;
}
.toggle input {
display: none;
}
.toggle-slider {
width: 36px;
height: 20px;
background: #ccc;
border-radius: 10px;
position: relative;
transition: background 0.2s;
}
.toggle-slider::after {
content: "";
position: absolute;
width: 16px;
height: 16px;
background: #fff;
border-radius: 50%;
top: 2px;
left: 2px;
transition: transform 0.2s;
}
.toggle input:checked + .toggle-slider {
background: #4a7dff;
}
.toggle input:checked + .toggle-slider::after {
transform: translateX(16px);
}
.toggle-label {
font-size: 12px;
color: #666;
}
/* ===== Audio Input (left panel) ===== */
.audio-input-stack {
display: flex;
flex-direction: column;
gap: 10px;
}
/* Input mode tabs */
.input-mode-tabs {
display: flex;
gap: 0;
border: 1px solid #d9d9d9;
border-radius: 6px;
overflow: hidden;
}
.mode-tab {
flex: 1;
padding: 6px 0;
border: none;
background: #fff;
font-size: 12px;
font-weight: 500;
color: #666;
cursor: pointer;
transition: all 0.2s;
text-align: center;
}
.mode-tab + .mode-tab {
border-left: 1px solid #d9d9d9;
}
.mode-tab.active {
background: #4a7dff;
color: #fff;
}
.mode-tab:hover:not(.active) {
background: #f0f5ff;
}
/* File select */
.file-select {
display: flex;
align-items: center;
gap: 10px;
}
.file-info {
font-size: 12px;
color: #888;
word-break: break-all;
}
.file-info.has-file {
color: #333;
font-weight: 500;
}
/* Audio meta info */
.audio-meta {
background: #f7f8fa;
border-radius: 6px;
padding: 8px 10px;
font-size: 12px;
}
.audio-meta-row {
display: flex;
justify-content: space-between;
padding: 2px 0;
}
.audio-meta-row .meta-k {
color: #888;
}
.audio-meta-row .meta-v {
color: #333;
font-family: "SF Mono", Menlo, monospace;
font-size: 11px;
}
/* Speed control */
.speed-control {
display: flex;
flex-direction: column;
gap: 4px;
}
.speed-label {
font-size: 12px;
font-weight: 500;
color: #555;
}
.speed-label span {
color: #4a7dff;
font-weight: 600;
}
#speedSlider {
width: 100%;
height: 4px;
-webkit-appearance: none;
appearance: none;
background: #e5e5e5;
border-radius: 2px;
outline: none;
}
#speedSlider::-webkit-slider-thumb {
-webkit-appearance: none;
width: 16px;
height: 16px;
border-radius: 50%;
background: #4a7dff;
cursor: pointer;
}
/* Microphone panel */
.mic-status {
text-align: center;
color: #888;
font-size: 13px;
padding: 8px 0;
}
.mic-timer {
text-align: center;
font-size: 14px;
font-weight: 600;
color: #ff4d4f;
padding: 8px 0;
animation: pulse 1s infinite;
}
.mic-timer span {
font-family: "SF Mono", Menlo, monospace;
margin-left: 4px;
}
.controls {
display: flex;
gap: 8px;
}
/* ===== Buttons ===== */
.btn {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 7px 16px;
border: none;
border-radius: 6px;
font-size: 13px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s;
white-space: nowrap;
}
.btn:disabled {
opacity: 0.45;
cursor: not-allowed;
}
.btn-primary {
background: #4a7dff;
color: #fff;
}
.btn-primary:hover:not(:disabled) {
background: #3a6ae8;
}
.btn-danger {
background: #ff4d4f;
color: #fff;
}
.btn-danger:hover:not(:disabled) {
background: #e63e40;
}
.btn-outline {
background: #fff;
color: #4a7dff;
border: 1px solid #4a7dff;
}
.btn-outline:hover {
background: #f0f5ff;
}
.btn-icon {
background: none;
border: none;
cursor: pointer;
font-size: 14px;
padding: 2px 4px;
border-radius: 4px;
transition: background 0.15s;
}
.btn-icon:hover {
background: #f0f0f0;
}
.btn-icon.copy-success {
background: #e6f7e9;
}
/* Export WAV button */
.btn-export {
margin-left: 4px;
font-size: 11px !important;
padding: 2px 8px !important;
}
.btn-export:disabled {
opacity: 0.35;
cursor: not-allowed;
}
/* ===== Copy Toast ===== */
.copy-toast {
position: fixed;
top: 20px;
left: 50%;
transform: translateX(-50%) translateY(-10px);
background: #333;
color: #fff;
padding: 6px 18px;
border-radius: 6px;
font-size: 13px;
font-weight: 500;
z-index: 9999;
opacity: 0;
transition: opacity 0.25s, transform 0.25s;
pointer-events: none;
white-space: nowrap;
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.copy-toast.visible {
opacity: 1;
transform: translateX(-50%) translateY(0);
}
.copy-toast-error {
background: #ff4d4f;
}
/* ===== Result Section (right panel) ===== */
.result-card {
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
background: #fff;
}
.result-meta {
display: flex;
align-items: center;
gap: 20px;
margin-bottom: 10px;
padding: 6px 10px;
background: #f7f8fa;
border-radius: 6px;
font-size: 12px;
flex-shrink: 0;
}
.meta-item {
display: flex;
align-items: center;
gap: 5px;
}
.meta-label {
color: #888;
}
.meta-value {
color: #333;
font-family: "SF Mono", Menlo, monospace;
font-size: 11px;
}
.status-dot {
width: 8px;
height: 8px;
border-radius: 50%;
background: #ccc;
}
.status-dot.connecting {
background: #faad14;
animation: pulse 1s infinite;
}
.status-dot.running {
background: #52c41a;
animation: pulse 1s infinite;
}
.status-dot.done {
background: #4a7dff;
}
.status-dot.error {
background: #ff4d4f;
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.4; }
}
.result-area {
flex: 1;
overflow-y: auto;
padding: 4px 0;
}
.placeholder {
text-align: center;
color: #bbb;
padding: 60px 0;
font-size: 14px;
}
/* ===== Subtitle Mode (no speaker diarization) ===== */
.subtitle-item {
display: flex;
align-items: flex-start;
gap: 10px;
padding: 5px 8px;
border-radius: 6px;
margin-bottom: 3px;
transition: background 0.15s;
}
.subtitle-item:hover {
background: #f7f8fa;
}
.subtitle-time {
font-size: 11px;
color: #999;
font-family: "SF Mono", Menlo, monospace;
white-space: nowrap;
min-width: 100px;
padding-top: 2px;
}
.subtitle-text {
font-size: 14px;
color: #1a1a2e;
word-break: break-word;
transition: color 0.3s ease;
}
.subtitle-text.interim {
color: #999;
font-style: italic;
}
.subtitle-text.final {
color: #000;
font-style: normal;
font-weight: 500;
}
.subtitle-item.subtitle-interim {
opacity: 0.8;
}
/* ===== Bubble Mode (speaker diarization) ===== */
.bubble-row {
display: flex;
margin-bottom: 10px;
}
.bubble-row.speaker-left {
justify-content: flex-start;
}
.bubble-row.speaker-right {
justify-content: flex-end;
}
.bubble-row.speaker-unknown .bubble-body {
background: #f0f0f0;
color: #999;
font-style: italic;
border-radius: 12px;
border-top-left-radius: 4px;
}
.speaker-badge.speaker-color-unknown {
background-color: #ccc;
}
.bubble-wrapper {
max-width: 80%;
}
.bubble-header {
font-size: 11px;
color: #888;
margin-bottom: 3px;
display: flex;
align-items: center;
gap: 5px;
}
.speaker-right .bubble-header {
justify-content: flex-end;
}
.speaker-badge {
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
}
.bubble-body {
padding: 9px 13px;
border-radius: 12px;
font-size: 14px;
line-height: 1.5;
word-break: break-word;
}
.speaker-left .bubble-body {
background: #e8f0fe;
color: #1a1a2e;
border-top-left-radius: 4px;
}
.speaker-right .bubble-body {
background: #e6f7e9;
color: #1a1a2e;
border-top-right-radius: 4px;
text-align: right;
}
.bubble-body.interim {
opacity: 0.6;
font-style: italic;
}
/* Pending text (speaker_id=-1) appended to confirmed bubble */
.pending-text {
display: inline;
color: #aaa;
font-style: italic;
opacity: 0.7;
margin-left: 2px;
transition: opacity 0.3s ease;
}
.pending-text::before {
content: ' ';
}
.bubble-time {
font-size: 10px;
color: #bbb;
font-family: "SF Mono", Menlo, monospace;
}
/* ===== Speaker Colors ===== */
.speaker-color-0 { background-color: #4a7dff; }
.speaker-color-1 { background-color: #52c41a; }
.speaker-color-2 { background-color: #faad14; }
.speaker-color-3 { background-color: #ff4d4f; }
.speaker-color-4 { background-color: #9254de; }
.speaker-color-5 { background-color: #13c2c2; }
.bubble-row.speaker-2 .bubble-body { background: #fff7e6; }
.bubble-row.speaker-3 .bubble-body { background: #fff1f0; }
.bubble-row.speaker-4 .bubble-body { background: #f9f0ff; }
.bubble-row.speaker-5 .bubble-body { background: #e6fffb; }
/* ===== Responsive ===== */
@media (max-width: 768px) {
.layout {
flex-direction: column;
height: auto;
}
.panel-left {
width: 100%;
min-width: unset;
border-right: none;
border-bottom: 1px solid #e5e5e5;
max-height: 40vh;
}
.panel-right {
min-height: 60vh;
}
}
/* ===== Log Panel ===== */
.log-card {
height: 240px;
min-height: 180px;
flex-shrink: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
.log-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 8px;
padding-bottom: 6px;
border-bottom: 1px solid #eee;
}
.log-header h2 {
margin-bottom: 0;
padding-bottom: 0;
border-bottom: none;
}
.btn-sm {
padding: 3px 10px;
font-size: 11px;
}
.log-area {
flex: 1;
overflow-y: auto;
background: #1e1e2e;
border-radius: 6px;
padding: 8px 10px;
font-family: "SF Mono", Menlo, Consolas, monospace;
font-size: 11px;
line-height: 1.5;
color: #cdd6f4;
}
.log-entry {
padding: 2px 0;
border-bottom: 1px solid rgba(255,255,255,0.05);
word-break: break-all;
}
.log-time {
color: #6c7086;
margin-right: 6px;
}
.log-type-start { color: #a6e3a1; }
.log-type-voice_id { color: #cba6f7; }
.log-type-sentences { color: #89b4fa; }
.log-type-result { color: #89b4fa; }
.log-type-end { color: #f9e2af; }
.log-type-error { color: #f38ba8; }