:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1f232c;
  --border: #2a2f3a;
  --text: #e8eaed;
  --text-dim: #9aa1ac;
  --accent: #5b8cff;
  --accent-hover: #7aa2ff;
  --success: #34c77b;
  --error: #ff6b6b;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.site-header {
  padding: 40px 20px 20px;
  text-align: center;
}

.site-header h1 {
  margin: 0 0 8px;
  font-size: 2rem;
  font-weight: 700;
}

.tagline {
  color: var(--text-dim);
  max-width: 560px;
  margin: 0 auto;
  font-size: 0.95rem;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.card h2 {
  margin: 0 0 16px;
  font-size: 1.1rem;
}

.status-box {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  font-size: 0.9rem;
}

.status-box.status-ready {
  border-color: var(--success);
}

.status-box.status-error {
  border-color: var(--error);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

.progress-track {
  margin-top: 8px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  width: 260px;
  max-width: 100%;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.2s ease;
}

#engine-progress-text {
  color: var(--text-dim);
  font-size: 0.82rem;
  margin-top: 2px;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  color: var(--text-dim);
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--surface-2);
  color: var(--text);
}

.dropzone code {
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
}

.file-info {
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 0.9rem;
}

.file-info strong { color: var(--accent); }

.hidden { display: none !important; }

.paste-toggle {
  margin-top: 16px;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.paste-toggle summary {
  cursor: pointer;
  color: var(--accent);
}

.paste-toggle textarea {
  width: 100%;
  min-height: 140px;
  margin-top: 10px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: "SF Mono", Consolas, Menlo, monospace;
  font-size: 0.85rem;
  resize: vertical;
}

.paste-toggle input[type="text"] {
  width: 100%;
  margin-top: 8px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.85rem;
}

.format-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.format-option {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: border-color 0.15s;
}

.format-option:has(input:checked) {
  border-color: var(--accent);
}

.format-option input {
  accent-color: var(--accent);
}

.format-actions {
  margin-top: 12px;
  display: flex;
  gap: 16px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
}

.btn-link:hover { color: var(--accent-hover); }

.note {
  margin: 16px 0 0;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.btn-primary {
  background: var(--accent);
  color: #0b0d12;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.convert-status {
  margin-top: 14px;
  font-size: 0.88rem;
  color: var(--text-dim);
  white-space: pre-line;
}

.results-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.results-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.9rem;
}

.results-list li.failed {
  border-color: var(--error);
  color: var(--error);
}

.results-list a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.results-list a:hover { text-decoration: underline; }

.site-footer {
  text-align: center;
  padding: 30px 20px 50px;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.site-footer a { color: var(--accent); }
