/* =========================================================
   智能音频动态切换交互演示 · 全局样式系统
   风格：深空黑/曜石蓝现代声学控制台 (Modern Acoustic Slate Console)
   ========================================================= */

:root {
  --bg-dark: #090d16;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(28, 38, 60, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(56, 189, 248, 0.4);

  --primary: #0284c7;
  --primary-glow: #38bdf8;
  --primary-gradient: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);

  --accent-soothe: #10b981;
  --accent-soothe-gradient: linear-gradient(135deg, #059669 0%, #34d399 100%);
  --accent-vigor: #f59e0b;
  --accent-vigor-gradient: linear-gradient(135deg, #d97706 0%, #fbbf24 100%);
  --accent-sleep: #8b5cf6;
  --accent-sleep-gradient: linear-gradient(135deg, #6d28d9 0%, #a78bfa 100%);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --danger: #ef4444;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(56, 189, 248, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 75%, rgba(139, 92, 246, 0.08) 0%, transparent 40%);
  color: var(--text-main);
  font-family: var(--font-family);
  line-height: 1.5;
  min-height: 100vh;
  padding: 24px;
}

.app-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* --- 顶部 Header --- */
.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: var(--primary-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.4);
}

.brand-title h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand-title p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.status-pills {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
}

.status-online {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

.status-idle {
  color: var(--text-muted);
}

/* 激活横幅 */
.init-banner {
  background: linear-gradient(90deg, #1e3a8a 0%, #312e81 100%);
  border: 1px solid rgba(96, 165, 250, 0.4);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* 主栅格布局 */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

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

.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 10px;
}

.card-title .hint {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
}

/* 按钮组 */
.btn-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 640px) {
  .btn-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary {
  background: var(--primary-gradient);
  border-color: var(--primary-glow);
  color: white;
  box-shadow: 0 0 16px rgba(2, 132, 199, 0.4);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.6);
}

.btn-mode.active {
  box-shadow: 0 0 20px currentColor;
  border-color: currentColor;
}

.btn-mode-smart.active {
  background: var(--primary-gradient);
  color: white;
}

.btn-mode-soothe.active {
  background: var(--accent-soothe-gradient);
  color: white;
}

.btn-mode-vigor.active {
  background: var(--accent-vigor-gradient);
  color: white;
}

.btn-mode-sleep.active {
  background: var(--accent-sleep-gradient);
  color: white;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

/* 状态模拟专区 */
.state-trigger-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.btn-state {
  flex-direction: column;
  padding: 14px;
  text-align: center;
}

.btn-state span.desc {
  font-size: 0.72rem;
  font-weight: normal;
  color: var(--text-muted);
  margin-top: 4px;
}

.btn-state-soothe.active {
  border-color: var(--accent-soothe);
  background: rgba(16, 185, 129, 0.2);
}

.btn-state-vigor.active {
  border-color: var(--accent-vigor);
  background: rgba(245, 158, 11, 0.2);
}

.btn-state-sleep.active {
  border-color: var(--accent-sleep);
  background: rgba(139, 92, 246, 0.2);
}

/* 进度条与检测卡片 */
.progress-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0, 0, 0, 0.25);
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.progress-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

.progress-fill-transition {
  background: linear-gradient(90deg, #ec4899, #8b5cf6, #3b82f6);
}

/* 时间轴拖拽滑动器包装层 */
.timeline-slider-wrapper {
  position: relative;
  width: 100%;
  height: 24px;
  display: flex;
  align-items: center;
  margin: 6px 0;
}

.timeline-slider-track {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.timeline-slider {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  height: 24px;
  opacity: 1;
  background: transparent !important;
  cursor: pointer;
  z-index: 2;
  margin: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
}

.timeline-slider::-webkit-slider-runnable-track {
  background: transparent;
  height: 8px;
}

.timeline-slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #38bdf8;
  border: 2px solid #ffffff;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.9);
  cursor: grab;
  margin-top: -5px; /* (8px 轨道高度 - 18px 滑块高度) / 2 = -5px，实现严格数学纵向居中 */
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.timeline-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  box-shadow: 0 0 18px rgba(56, 189, 248, 1);
}

.timeline-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.35);
  background: #0284c7;
}

.timeline-slider::-moz-range-track {
  background: transparent;
  height: 8px;
}

.timeline-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #38bdf8;
  border: 2px solid #ffffff;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.9);
  cursor: grab;
}

.timeline-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 4px;
  position: relative;
}

.timeline-ticks span {
  white-space: nowrap;
}

/* 当前语音高亮卡片 */
.voice-banner {
  background: rgba(2, 132, 199, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.3s ease;
}

.voice-banner.playing {
  background: rgba(2, 132, 199, 0.22);
  border-color: var(--primary-glow);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.2);
}

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

.voice-subtitle {
  font-size: 1.15rem;
  font-weight: 600;
  color: #bae6fd;
}

/* 声波动画 */
.wave-anim {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 16px;
}

.wave-bar {
  width: 3px;
  height: 100%;
  background: var(--primary-glow);
  border-radius: 9999px;
  animation: wavePulse 1s ease-in-out infinite;
}

.wave-bar:nth-child(2) { animation-delay: 0.2s; }
.wave-bar:nth-child(3) { animation-delay: 0.4s; }
.wave-bar:nth-child(4) { animation-delay: 0.6s; }

@keyframes wavePulse {
  0%, 100% { height: 4px; }
  50% { height: 16px; }
}

/* 控制滑块条 */
.slider-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.slider-row {
  display: grid;
  grid-template-columns: 140px 1fr 60px;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
}

input[type="range"] {
  appearance: none;
  background: rgba(255, 255, 255, 0.1);
  height: 6px;
  border-radius: 3px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary-glow);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
}

/* 可视化 Canvas */
.canvas-wrapper {
  width: 100%;
  height: 80px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* 素材抽检表格 */
.table-wrapper {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: left;
}

th, td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

th {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

code {
  font-family: Consolas, Monaco, monospace;
  color: #38bdf8;
  font-size: 0.78rem;
}

.badge-tag {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

/* 日志控制台 */
.log-box {
  height: 180px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px;
  overflow-y: auto;
  font-family: Consolas, Monaco, monospace;
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-line {
  line-height: 1.4;
}

.log-time { color: var(--text-dim); margin-right: 6px; }
.log-tag { font-weight: bold; margin-right: 6px; }

.log-system .log-tag { color: #a78bfa; }
.log-mode .log-tag { color: #38bdf8; }
.log-bgm .log-tag { color: #34d399; }
.log-voice .log-tag { color: #f472b6; }
.log-ducking .log-tag { color: #fbbf24; }
.log-param .log-tag { color: #94a3b8; }
.log-error .log-tag { color: #f87171; }
.log-error .log-msg { color: #fca5a5; }

/* 禁用遮罩（整体呈现明显的灰色调，亮度降低，不可操作、使用的状态） */
.disabled-zone {
  opacity: 0.3 !important;
  pointer-events: none !important;
  filter: grayscale(1) brightness(0.6) !important;
  transition: all 0.35s ease;
  user-select: none !important;
}
