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

:root {
  --primary: #FF6A00;
  --primary-hover: #E55D00;
  --bg: #0F0F13;
  --surface: #1A1A22;
  --surface-2: #22222D;
  --border: #2D2D3A;
  --text: #E8E8ED;
  --text-secondary: #8B8B9E;
  --danger: #FF4757;
  --success: #2ED573;
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

header {
  text-align: center;
  margin-bottom: 32px;
}

header h1 {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, #FF6A00, #FF9A44);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

/* API Key */
.api-key-section {
  margin-bottom: 20px;
}

.api-key-section label,
.config-section label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-group {
  display: flex;
  gap: 8px;
}

.input-group input {
  flex: 1;
}

input, select {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

input:focus, select:focus {
  border-color: var(--primary);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238B8B9E' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.icon-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 12px;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 16px;
}

.icon-btn:hover {
  background: var(--surface-2);
}

/* Config */
.config-section {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.config-row {
  flex: 1;
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  margin-top: 4px;
}

.switch input { display: none; }

.slider {
  position: absolute;
  inset: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 26px;
  cursor: pointer;
  transition: 0.3s;
}

.slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 2px;
  bottom: 2px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: 0.3s;
}

.switch input:checked + .slider {
  background: var(--primary);
  border-color: var(--primary);
}

.switch input:checked + .slider::before {
  transform: translateX(22px);
  background: white;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  padding: 4px;
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.tab {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.tab.active {
  background: var(--surface-2);
  color: var(--text);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Record */
.record-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px 0;
}

.record-btn {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 3px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.3s;
}

.record-btn .mic-icon {
  font-size: 32px;
}

.record-btn .btn-text {
  font-size: 10px;
  color: var(--text-secondary);
}

.record-btn:hover {
  border-color: var(--primary);
  transform: scale(1.05);
}

.record-btn.recording {
  border-color: var(--danger);
  background: rgba(255, 71, 87, 0.15);
  animation: pulse 1.5s infinite;
}

.record-btn.recording .btn-text {
  color: var(--danger);
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.4); }
  50% { box-shadow: 0 0 0 16px rgba(255, 71, 87, 0); }
}

/* Wave animation */
.status {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wave {
  display: flex;
  gap: 3px;
  align-items: center;
  height: 24px;
}

.wave span {
  width: 3px;
  background: var(--danger);
  border-radius: 3px;
  animation: wave 1s ease-in-out infinite;
}

.wave span:nth-child(1) { animation-delay: 0s; height: 8px; }
.wave span:nth-child(2) { animation-delay: 0.15s; height: 16px; }
.wave span:nth-child(3) { animation-delay: 0.3s; height: 24px; }
.wave span:nth-child(4) { animation-delay: 0.45s; height: 16px; }
.wave span:nth-child(5) { animation-delay: 0.6s; height: 8px; }

@keyframes wave {
  0%, 100% { transform: scaleY(0.5); }
  50% { transform: scaleY(1); }
}

.timer {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 18px;
  color: var(--danger);
  font-weight: 600;
}

/* Upload */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-area:hover, .upload-area.drag-over {
  border-color: var(--primary);
  background: rgba(255, 106, 0, 0.05);
}

.upload-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.upload-area p {
  color: var(--text-secondary);
  font-size: 14px;
}

.link {
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
}

.hint {
  font-size: 12px !important;
  margin-top: 4px;
}

.file-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  margin-top: 12px;
  font-size: 14px;
}

.file-info audio {
  width: 100%;
  margin-top: 8px;
}

/* Audio elements */
audio {
  width: 100%;
  height: 40px;
  border-radius: 8px;
}

/* Submit */
.submit-btn {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.submit-btn:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Result */
.result-section {
  margin-top: 24px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.result-header h2 {
  font-size: 15px;
  font-weight: 600;
}

.result-text {
  padding: 18px;
  font-size: 16px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 60px;
  max-height: 400px;
  overflow-y: auto;
}

.result-text.streaming::after {
  content: '▊';
  animation: blink 1s step-end infinite;
  color: var(--primary);
}

@keyframes blink {
  50% { opacity: 0; }
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface-2);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  border: 1px solid var(--border);
  transition: transform 0.3s ease;
  z-index: 100;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

footer {
  text-align: center;
  margin-top: 40px;
  color: var(--text-secondary);
  font-size: 13px;
}

/* Demo Section */
.demo-section {
  background: linear-gradient(135deg, rgba(255, 106, 0, 0.08), rgba(255, 154, 68, 0.04));
  border: 1px solid rgba(255, 106, 0, 0.2);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}

.demo-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.demo-tag {
  background: var(--primary);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.demo-audio {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.demo-audio audio {
  flex: 1;
  height: 36px;
}

.demo-use-btn {
  padding: 8px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.demo-use-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.demo-use-btn.used {
  background: var(--success);
}

.demo-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
}

.hidden { display: none !important; }

@media (max-width: 480px) {
  .container { padding: 16px 12px 40px; }
  header h1 { font-size: 24px; }
  .config-section { flex-direction: column; gap: 12px; }
}
