:root {
  --bg: #0c0c0f;
  --surface: #16161c;
  --border: #2a2a34;
  --text: #ececf1;
  --muted: #8e8ea0;
  --accent: #c4a574;
  --accent-dim: #8b7355;
  --danger: #f87171;
  --radius: 12px;
  --font: "DM Sans", system-ui, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: radial-gradient(ellipse 120% 80% at 50% -20%, #1f1a16 0%, var(--bg) 55%);
  color: var(--text);
  line-height: 1.5;
}

.layout {
  max-width: 920px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

.header {
  margin-bottom: 2rem;
}

.title {
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
  color: var(--text);
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.35rem;
  margin-bottom: 1.25rem;
}

.label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 200px;
  padding: 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0f0f12;
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
}

textarea:focus {
  outline: 2px solid var(--accent-dim);
  outline-offset: 2px;
}

.options {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: center;
  margin: 1.25rem 0;
}

.field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.field input[type="number"] {
  width: 4rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0f0f12;
  color: var(--text);
}

.check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
}

.check input {
  accent-color: var(--accent);
}

.primary {
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.75rem 1.35rem;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, #a68b5b 100%);
  color: #0c0c0f;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.primary:hover:not(:disabled) {
  filter: brightness(1.06);
}

.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.error {
  color: var(--danger);
  margin-top: 0.75rem;
  font-size: 0.95rem;
}

.pipeline .h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 0 0 1rem;
  font-weight: 600;
}

.flow {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
}

.flow li {
  font-size: 0.82rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  position: relative;
}

.flow li:not(:last-child)::after {
  content: "↓";
  position: absolute;
  right: -0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--border);
  font-size: 0.7rem;
  pointer-events: none;
}

.flow li.active {
  border-color: var(--accent-dim);
  color: var(--accent);
  background: rgba(196, 165, 116, 0.08);
}

.flow li.done {
  border-color: #3d4a3d;
  color: #a3c4a3;
}

.stage-log {
  margin-top: 1.25rem;
  font-size: 0.85rem;
  color: var(--muted);
  max-height: 160px;
  overflow-y: auto;
  white-space: pre-wrap;
  font-family: ui-monospace, monospace;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

.scenes-out {
  margin-top: 1rem;
}

.scene-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.65rem;
  background: #0f0f12;
}

.scene-card h3 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.scene-card p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.scene-card .prompt {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text);
  opacity: 0.9;
}

.result {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.download {
  display: inline-block;
  margin-bottom: 0.75rem;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.download:hover {
  text-decoration: underline;
}

video {
  width: 100%;
  max-height: 420px;
  border-radius: 10px;
  background: #000;
}

.footer {
  margin-top: 2rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

.footer code {
  font-size: 0.8em;
  background: var(--surface);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
}

.muted {
  display: block;
  margin-top: 0.35rem;
}

@media (min-width: 720px) {
  .flow li:not(:last-child)::after {
    content: "→";
    right: -0.85rem;
  }
}
