:root {
  --bg:      #0e1116;
  --panel:   #171b22;
  --panel-2: #1e232c;
  --border:  #2a313c;
  --text:    #e6e9ee;
  --muted:   #8b94a3;
  --accent:  #e9b44c;   /* ámbar: relato / cine */
  --accent-d:#c9973a;
  --ok:      #4caf7d;
  --err:     #e06b6b;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); line-height: 1.5;
}

header {
  padding: 28px 32px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap;
}
header h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
header .tag {
  font-family: var(--mono); font-size: 12px; color: var(--accent);
  border: 1px solid var(--accent-d); border-radius: 4px; padding: 2px 8px;
}
header .sub { color: var(--muted); font-size: 13px; margin-left: auto; }

main { max-width: 1180px; margin: 0 auto; padding: 28px 32px 80px; }

.idea-row { display: flex; gap: 12px; align-items: stretch; margin-bottom: 8px; }
.idea-row textarea {
  flex: 1; min-height: 64px; resize: vertical;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px;
  font-family: var(--sans); font-size: 15px;
}
.idea-row textarea:focus { outline: none; border-color: var(--accent-d); }

button {
  font-family: var(--sans); font-weight: 600; cursor: pointer;
  border-radius: 8px; border: 1px solid transparent; padding: 10px 16px;
  font-size: 14px; transition: background .15s, border-color .15s;
}
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #1a1200; }
.btn-primary:hover:not(:disabled) { background: var(--accent-d); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { border-color: var(--muted); }
.btn-sm { padding: 7px 12px; font-size: 13px; }

.hint { color: var(--muted); font-size: 13px; margin: 4px 0 26px; }

/* Storyboard grid */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }

.scene {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden; display: flex; flex-direction: column;
}
.frame {
  position: relative; aspect-ratio: 9 / 16; background: var(--panel-2);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.frame .placeholder { color: var(--muted); font-size: 13px; text-align: center; padding: 0 16px; }
.frame .num {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  font-family: var(--mono); font-size: 12px; font-weight: 700;
  background: rgba(0,0,0,.6); color: var(--accent);
  border: 1px solid var(--accent-d); border-radius: 5px; padding: 3px 8px;
}
.frame .loading {
  position: absolute; inset: 0; background: rgba(14,17,22,.75);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 12px; color: var(--accent);
}

.scene .body { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.scene label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.scene textarea, .scene input[type=text], .scene input[type=number] {
  width: 100%; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 7px; padding: 8px 10px;
  font-family: var(--sans); font-size: 13px; resize: vertical;
}
.scene .prompt { font-family: var(--mono); font-size: 12px; }
.scene input:focus, .scene textarea:focus { outline: none; border-color: var(--accent-d); }

.scene .dur { display: flex; align-items: center; gap: 8px; }
.scene .dur input { width: 80px; font-family: var(--mono); }
.scene .dur span { font-family: var(--mono); font-size: 12px; color: var(--muted); }

.scene .actions { display: flex; gap: 8px; }
.scene .actions button, .scene .actions label.upload {
  flex: 1; text-align: center; font-size: 13px; padding: 8px 6px; border-radius: 7px;
}
label.upload {
  border: 1px solid var(--border); color: var(--text); cursor: pointer;
  display: inline-block; font-weight: 600;
}
label.upload:hover { border-color: var(--muted); }
label.upload input { display: none; }

.scene .remove {
  align-self: flex-end; background: none; border: none; color: var(--err);
  font-size: 12px; padding: 2px 4px;
}

/* Footer bar */
.footer {
  margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--border);
  display: flex; gap: 20px; align-items: flex-end; flex-wrap: wrap;
}
.footer .field { display: flex; flex-direction: column; gap: 6px; }
.footer label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.footer input, .footer select {
  background: var(--panel); color: var(--text); border: 1px solid var(--border);
  border-radius: 7px; padding: 8px 10px; font-family: var(--mono); font-size: 13px;
}
.footer .spacer { flex: 1; }

.status { font-family: var(--mono); font-size: 13px; margin-top: 14px; min-height: 20px; }
.status.ok  { color: var(--ok); }
.status.err { color: var(--err); }

.empty { color: var(--muted); text-align: center; padding: 60px 0; font-size: 14px; }

#progress-wrap { display:none; margin-top:14px; height:10px; background:var(--panel-2);
  border:1px solid var(--border); border-radius:6px; overflow:hidden; }
#progress-bar { height:100%; width:0; background:var(--accent); transition:width .3s; }
#video-wrap { display:none; margin-top:18px; flex-direction:column; gap:10px; align-items:flex-start; }
#preview { width:280px; max-width:100%; border-radius:10px; border:1px solid var(--border); background:#000; }
#download { text-decoration:none; }
