:root {
  --bg: #0f0f12;
  --surface: #1a1a1f;
  --border: #2a2a32;
  --text: #e8e8ed;
  --text-muted: #8888a0;
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --secondary: #3f3f46;
  --success: #22c55e;
  --error: #ef4444;
  --radius: 10px;
  --font: 'Segoe UI', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.header {
  margin-bottom: 2rem;
}

.header h1 {
  margin: 0 0 0.25rem 0;
  font-size: 1.75rem;
  font-weight: 600;
}

.subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.config {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 520px) {
  .config {
    grid-template-columns: 1fr;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.field.token-field {
  grid-column: 1 / -1;
}

.field select,
.field input {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
}

.field select:focus,
.field input:focus {
  outline: none;
  border-color: var(--primary);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.btn {
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--secondary);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: #52525b;
}

.status {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.status.live {
  color: var(--success);
}

.status.error {
  color: var(--error);
}

.output {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.panel h2 {
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
}

.text-box {
  min-height: 4rem;
  padding: 0.5rem 0;
  font-size: 1rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.text-box.empty {
  color: var(--text-muted);
}

.partial-text {
  font-style: italic;
}

.final-text {
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
  padding-top: 0.75rem;
}

.final-text .segment {
  margin-bottom: 0.5rem;
}

.final-text .segment:last-child {
  margin-bottom: 0;
}

.final-text .original {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.final-text .translation {
  color: var(--text);
}
