:root {
  --bg: #0b0c0f;
  --surface: #12141a;
  --surface-2: #191c24;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #ecebe6;
  --text-2: #b9bcc6;
  --muted: #858a97;
  --accent: #e2b65a;
  --accent-2: #f0cd7d;
  --accent-ink: #1a1305;
  --ok: #5fc98f;
  --warn: #e0a552;
  --bad: #e07272;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--sans); }
body { min-height: 100vh; }
h1 { margin: 0; font-size: 28px; letter-spacing: -0.02em; }
p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.eyebrow { color: var(--muted); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; margin: 0 0 2px; }
.hint, .lede { color: var(--text-2); }
.hint { font-size: 12.5px; }
.muted { color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 500;
}
.btn:hover { background: #21252f; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.top {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 18px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: rgba(11, 12, 15, 0.92); backdrop-filter: blur(10px); z-index: 2;
}
.brand { min-width: 140px; }
.machine { display: flex; align-items: center; gap: 8px; flex: 1; }
.machine select, .controls select, .controls input[type="text"], #seed {
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px;
}
.pill {
  font-family: var(--mono); font-size: 12px; color: var(--text-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px;
}
.pill.on { color: var(--ok); }
.pill.busy { color: var(--warn); }
.pill.bad { color: var(--bad); }

.layout { display: grid; grid-template-columns: 280px 1fr; min-height: calc(100vh - 62px); }
.list { border-right: 1px solid var(--line); overflow: auto; }
.list button.row {
  display: grid; grid-template-columns: 52px 1fr; gap: 10px; width: 100%;
  text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--line);
  padding: 10px 12px; cursor: pointer; color: inherit;
}
.list button.row.on { background: var(--surface-2); }
.list img, .thumb {
  width: 52px; height: 52px; object-fit: cover; border-radius: 8px; background: var(--surface-2);
}
.list .title { font-weight: 600; }
.list .meta { color: var(--muted); font-size: 12px; }

main { display: flex; flex-direction: column; min-width: 0; }
.stage { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.viewer {
  flex: 1; min-height: 360px; margin: 16px; border: 1px solid var(--line); border-radius: 16px;
  background:
    radial-gradient(ellipse at center, #1a1e28 0%, #0b0c0f 70%);
  display: grid; place-items: center; overflow: hidden; position: relative;
}
.viewer model-viewer, .viewer img.hero, .viewer video { width: 100%; height: 100%; min-height: 360px; }
.viewer .empty { max-width: 46ch; color: var(--text-2); padding: 24px; text-align: center; }
.strips { display: flex; gap: 8px; padding: 0 16px 12px; overflow: auto; }
.strips img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.badge {
  position: absolute; left: 12px; top: 12px; background: rgba(0,0,0,.55);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 12px;
}

.composer { border-top: 1px solid var(--line); padding: 12px 16px 16px; background: var(--surface); }
textarea {
  width: 100%; resize: vertical; min-height: 52px; background: var(--surface-2);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px;
}
.controls { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; margin-top: 10px; }
.controls label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.controls .check { display: flex; align-items: center; gap: 6px; padding-bottom: 8px; }
.file input { max-width: 160px; }

.actions { display: flex; gap: 8px; margin-top: 8px; }
.error { color: var(--bad); }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login {
  width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 28px; display: grid; gap: 10px;
}
.login input {
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 8px; padding: 10px 12px;
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .list { max-height: 220px; border-right: 0; border-bottom: 1px solid var(--line); }
  .top { flex-wrap: wrap; }
}
