:root {
  --bg: #1a1a2e;
  --card: #16213e;
  --accent: #0f3460;
  --highlight: #e94560;
  --text: #eee;
  --dim: #8892b0;
  --green: #4ecca3;
  --yellow: #f0a500;
  --radius: 8px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 20px;
}
.container { max-width: 760px; width: 100%; }

/* Header */
.header { text-align: center; margin-bottom: 16px; }
.header h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
.header h1 span { color: var(--highlight); }
.header p { color: var(--dim); font-size: 14px; margin-top: 4px; }

/* WebGPU badge */
.webgpu-badge {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  font-family: monospace;
  background: rgba(136, 146, 176, 0.15);
  color: var(--dim);
  border: 1px solid transparent;
}
.webgpu-badge.ok    { color: var(--green);     border-color: rgba(78,204,163,0.4);  background: rgba(78,204,163,0.1); }
.webgpu-badge.warn  { color: var(--yellow);    border-color: rgba(240,165,0,0.4);   background: rgba(240,165,0,0.1); }
.webgpu-badge.error { color: var(--highlight); border-color: rgba(233,69,96,0.4);   background: rgba(233,69,96,0.1); }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--accent);
}
.tab-btn {
  flex: 1;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--dim);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--highlight); border-bottom-color: var(--highlight); }

/* Card */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--dim);
  margin-bottom: 12px;
}

/* Form */
.form-row { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; flex-wrap: wrap; }
.form-row label { font-size: 13px; color: var(--dim); min-width: 110px; }
.form-row input[type="text"],
.form-row input[type="number"],
.form-row textarea,
.form-row select {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
  font-family: inherit;
}
.form-row input[type="number"] { min-width: 80px; max-width: 120px; flex: 0; }
.form-row textarea { resize: vertical; min-height: 80px; }
.form-row input:focus, .form-row textarea:focus, .form-row select:focus { border-color: var(--highlight); }
.form-row input[type="range"] { flex: 1; }
.form-row input[type="checkbox"] { width: 16px; height: 16px; }
.range-value { color: var(--dim); font-size: 13px; min-width: 40px; text-align: right; }

/* Buttons */
.btn-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.btn {
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  font-family: inherit;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-load { background: var(--accent); color: var(--text); }
.btn-primary { background: var(--green); color: var(--bg); }
.btn-secondary { background: var(--highlight); color: var(--text); }
.btn-ghost { background: transparent; border: 1px solid var(--dim); color: var(--dim); }

/* Progress bar */
.progress-container { display: none; margin-top: 10px; }
.progress-track {
  width: 100%; height: 4px; background: var(--accent);
  border-radius: 2px; overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0%; background: var(--green);
  transition: width 0.2s;
}
.progress-info {
  font-size: 12px;
  color: var(--dim);
  font-family: monospace;
  margin-top: 6px;
  min-height: 16px;
}

/* Status */
.status {
  margin-top: 10px;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 4px;
  display: inline-block;
}
.status.idle { color: var(--dim); background: transparent; }
.status.loading { color: var(--yellow); background: rgba(240,165,0,0.1); }
.status.ready { color: var(--green); background: rgba(78,204,163,0.1); }
.status.listening { color: var(--green); background: rgba(78,204,163,0.1); }
.status.error { color: var(--highlight); background: rgba(233,69,96,0.1); }

/* VAD meter */
.vad-container { margin-top: 12px; }
.vad-track {
  width: 100%; height: 6px; background: var(--accent);
  border-radius: 3px; overflow: hidden;
}
.vad-fill {
  height: 100%; width: 0%; background: var(--dim);
  transition: width 0.1s, background 0.2s;
  border-radius: 3px;
}
.vad-fill.speech { background: var(--green); }
.vad-meta { display: flex; justify-content: space-between; margin-top: 4px; }
.vad-label { font-size: 12px; color: var(--dim); text-transform: uppercase; }
.vad-label.speech { color: var(--green); font-weight: 600; }
.vad-info { font-size: 12px; color: var(--dim); }

/* Transcript */
.transcript {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 160px;
  max-height: 360px;
  overflow-y: auto;
  font-size: 15px;
  line-height: 1.7;
  word-break: break-all;
}
.transcript-line {
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.transcript-line .timestamp {
  color: var(--dim);
  font-size: 12px;
  font-family: monospace;
  margin-right: 8px;
}
.transcript-line .tag {
  display: inline-block;
  font-size: 10px;
  font-family: monospace;
  padding: 1px 6px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: middle;
}
.transcript-line .tag-ctc { background: rgba(160,160,160,0.25); color: #bbb; }
.transcript-line .tag-llm { background: rgba(80,180,120,0.25); color: #6ec491; }
.partial {
  color: var(--dim);
  font-style: italic;
  padding: 8px 16px;
  min-height: 24px;
  font-size: 14px;
}

/* TTS output */
.audio-output {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.audio-output audio { width: 100%; }
.download-link {
  color: var(--green);
  text-decoration: none;
  font-size: 13px;
}
.download-link:hover { text-decoration: underline; }

/* Footer */
.footer {
  text-align: center;
  margin-top: 20px;
  font-size: 12px;
  color: var(--dim);
}
.footer a { color: var(--highlight); text-decoration: none; }
