:root {
  --bg-color: #0b0f19;
  --panel-bg: rgba(22, 28, 45, 0.75);
  --border-color: rgba(255, 255, 255, 0.08);
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --text-main: #f3f4f6;
  --text-sub: #9ca3af;
  --accent-glow: 0 0 20px rgba(59, 130, 246, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.05) 0%, transparent 40%);
}

header {
  padding: 24px 32px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(12px);
  background: rgba(11, 15, 25, 0.8);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-badge {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: white;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  letter-spacing: 0.5px;
}

.title {
  font-size: 20px;
  font-weight: 600;
  color: #fff;
}

.status-badge {
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
}

main {
  flex: 1;
  padding: 32px;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
}

@media (max-width: 960px) {
  main {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.24);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-title {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
}

select, input[type="text"] {
  background: rgba(11, 15, 25, 0.8);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}

select:focus, input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: var(--accent-glow);
}

.range-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

input[type="range"] {
  flex: 1;
  accent-color: var(--primary);
}

.range-val {
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
  min-width: 32px;
}

.switch-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.model-desc-box {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 8px;
  padding: 12px;
  font-size: 12px;
  color: #93c5fd;
  line-height: 1.5;
}

.record-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px;
  background: rgba(11, 15, 25, 0.5);
  border-radius: 12px;
  border: 1px dashed var(--border-color);
}

.record-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
}

.record-btn:hover {
  transform: scale(1.06);
}

.record-btn.recording {
  animation: pulse 1.5s infinite;
  background: #f59e0b;
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.5);
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

canvas#visualizer {
  width: 100%;
  height: 60px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
}

.drop-zone {
  border: 1px dashed var(--border-color);
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.drop-zone:hover {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.05);
}

.drop-text {
  font-size: 13px;
  color: var(--text-sub);
}

.result-card {
  background: rgba(11, 15, 25, 0.6);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border-color);
  min-height: 140px;
  position: relative;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.result-actions {
  display: flex;
  gap: 8px;
}

.result-text {
  font-size: 16px;
  line-height: 1.8;
  color: #fff;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 6px;
}

.result-paragraph {
  margin-bottom: 12px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.result-time-tag {
  font-size: 12px;
  font-family: monospace;
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
}

.result-content {
  flex: 1;
}

.copy-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-sub);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* 长音频流式分片流水线面板 (大厂级工程美学) */
.pipeline-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pipeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pipeline-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #93c5fd;
}

.pipeline-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3b82f6;
  animation: pulse-ring 1.8s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.9); opacity: 0.8; box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.6); }
  70% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 0 6px rgba(59, 130, 246, 0); }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.pipeline-badge {
  font-size: 12px;
  color: #60a5fa;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 2px 10px;
  border-radius: 9999px;
  font-family: monospace;
}

.progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  border-radius: 9999px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pipeline-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-sub);
}

/* 时间轴微缩胶囊轨道 (Minimap Track) */
.minimap-track {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  max-height: 80px;
  overflow-y: auto;
  padding: 6px 0;
}

.chunk-capsule {
  font-size: 11px;
  font-family: monospace;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: all 0.25s ease;
  user-select: none;
}

.chunk-capsule.pending {
  background: rgba(255, 255, 255, 0.04);
  color: #64748b;
  border-color: rgba(255, 255, 255, 0.05);
}

.chunk-capsule.running {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border-color: #3b82f6;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
  animation: pulse 1.2s infinite;
}

.chunk-capsule.retry {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border-color: #f59e0b;
}

.chunk-capsule.success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}

.chunk-capsule.failed {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: #ef4444;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
}

.metric-item {
  background: rgba(11, 15, 25, 0.5);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.metric-title {
  font-size: 12px;
  color: var(--text-sub);
}

.metric-value {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.metric-sub {
  font-size: 11px;
  color: #10b981;
}
