:root {
  --bg: #0e0f12;
  --bg-elev: #16181d;
  --bg-elev-2: #1d2027;
  --border: #262932;
  --text: #e6e8ee;
  --muted: #8c93a3;
  --accent: #6aa6ff;
  --accent-press: #4f8aea;
  --secondary: #b78cff;
  --secondary-press: #9b73e8;
  --ok: #5fd49a;
  --err: #ff7474;
  --warn: #ffcb6b;
  --radius: 10px;
  --gap: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  background: var(--bg-elev-2);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
  color: #d4dbeb;
}

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

.brand h1 {
  margin: 0;
  font-size: 32px;
  letter-spacing: -0.02em;
  font-weight: 700;
}
.brand .tagline {
  margin: 4px 0 0;
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.input-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
textarea {
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-family: inherit;
  font-size: 15px;
  resize: vertical;
  width: 100%;
  outline: none;
  transition: border-color 120ms ease, background 120ms ease;
}
textarea::placeholder { color: #555a66; }
textarea:focus {
  border-color: var(--accent);
  background: #181a20;
}

.input-actions {
  display: flex;
  gap: 10px;
}

button, .primary, .secondary, .ghost {
  font: inherit;
  border-radius: var(--radius);
  padding: 11px 18px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 120ms ease, transform 80ms ease, opacity 120ms ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.55; cursor: not-allowed; }

.primary {
  background: var(--accent);
  color: #0a0e16;
  font-weight: 600;
}
.primary:hover:not(:disabled) { background: var(--accent-press); }

.secondary {
  background: var(--secondary);
  color: #1a0f29;
  font-weight: 600;
}
.secondary:hover:not(:disabled) { background: var(--secondary-press); }

.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.ghost:hover:not(:disabled) { background: var(--bg-elev); }

a.primary {
  text-decoration: none;
  display: inline-flex;
}
a.primary:hover { text-decoration: none; }

.empty {
  background: var(--bg-elev);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  color: var(--muted);
}
.empty .hint { margin-bottom: 0; font-size: 14px; }

.result {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.meta {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.thumb {
  width: 140px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  background: #000;
  flex-shrink: 0;
}
.meta-text { flex: 1; min-width: 0; }
.meta-text h2 {
  margin: 0 0 4px;
  font-size: 18px;
  word-wrap: break-word;
}
.muted { color: var(--muted); margin: 0; font-size: 14px; }
.note {
  margin: 8px 0 0;
  color: var(--warn);
  font-size: 14px;
  background: rgba(255, 203, 107, 0.08);
  padding: 8px 10px;
  border-radius: 6px;
  border-left: 3px solid var(--warn);
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.progress {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.progress-row {
  display: flex;
  gap: 12px;
  align-items: center;
}
.bar {
  flex: 1;
  height: 10px;
  background: var(--bg-elev-2);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--secondary));
  transition: width 180ms ease-out;
}
.pct {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text);
  min-width: 56px;
  text-align: right;
}
.status {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.done {
  background: rgba(95, 212, 154, 0.07);
  border: 1px solid rgba(95, 212, 154, 0.3);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ok { margin: 0; color: var(--ok); }

.error {
  background: rgba(255, 116, 116, 0.06);
  border: 1px solid rgba(255, 116, 116, 0.35);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.err { margin: 0 0 4px; color: var(--err); }
.hint { color: var(--muted); font-size: 14px; margin: 6px 0 0; }

.logs {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 16px;
}
.logs summary {
  cursor: pointer;
  padding: 12px 0;
  color: var(--muted);
  user-select: none;
}
.logs[open] summary { color: var(--text); border-bottom: 1px solid var(--border); }
.logs pre {
  margin: 12px 0;
  max-height: 320px;
  overflow: auto;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.45;
  color: #c1c7d4;
  white-space: pre-wrap;
  word-break: break-all;
}

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  padding-top: 10px;
}

.hidden { display: none !important; }
