/* ── Reset / Variables ─────────────────────── */
:root {
  --bg: #0e1116;
  --bg-soft: #151921;
  --panel: #1c2028;
  --panel-2: #22262f;
  --border: #2a3346;
  --border-hi: #3a4460;
  --text: #e6e9ef;
  --muted: #7d8594;
  --accent: #6f8bff;
  --accent-2: #9f6fff;
  --ok: #d39142;
  --warn: #f0b429;
  --error: #f85149;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.hidden { display: none !important; }
a { color: var(--accent); }
button, input, select, textarea {
  font-family: inherit;
  font-size: 0.9rem;
  color: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  outline: none;
  padding: 7px 12px;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--border-hi);
}
textarea { resize: vertical; }
.btn {
  padding: 9px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--border); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #5c7aee; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.danger { background: #4a1e1e; border-color: #6e2a2a; color: #ff8a80; }
.btn.danger:hover { background: #6e2a2a; }
.btn.block { display: block; width: 100%; }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.mini-btn {
  padding: 4px 9px; border-radius: 6px; font-size: 0.82rem;
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  cursor: pointer;
}
.mini-btn:hover { background: var(--panel-2); color: var(--text); }
.danger-ghost { color: var(--error) !important; }
.danger-ghost:hover { background: rgba(248,81,73,0.12) !important; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 0.88rem; color: var(--muted); }
.check input { width: 16px; height: 16px; padding: 0; accent-color: var(--accent); }

/* ── Full-page viewport ──────────────────────── */
.viewport-full {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--bg);
}
.viewport-full .vp-panel {
  position: absolute;
  inset: 0;
}
.viewport-full .vp-panel.hidden { display: none; }
.viewport-full .vp-frame {
  position: absolute;
  inset: 0;
}
.viewport-full .vp-frame canvas,
.viewport-full .vp-frame::after {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.viewport-full canvas { object-fit: contain; }
.vp-frame.checker {
  background-image:
    linear-gradient(45deg, #1a1e26 25%, transparent 25%),
    linear-gradient(-45deg, #1a1e26 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1a1e26 75%),
    linear-gradient(-45deg, transparent 75%, #1a1e26 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-color: #141820;
}
.vp-controls {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(14,17,22,0.88);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  border: 1px solid var(--border);
  z-index: 2;
  font-size: 0.88rem;
}
.vp-btn {
  padding: 6px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}
.vp-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.vp-scrub { width: 160px; accent-color: var(--accent); }
.vp-time { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 0.85rem; }
.vp-label { color: var(--muted); font-size: 0.85rem; }
.vp-input { width: 52px; padding: 5px 7px; font-size: 0.88rem; text-align: center; }
.vp-check { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; font-size: 0.85rem; color: var(--muted); }
.vp-check input { width: 15px; height: 15px; accent-color: var(--accent); }
.vp-select { padding: 5px 8px; font-size: 0.88rem; }
.vp-empty {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--muted);
  font-size: 1rem;
  text-align: center;
  pointer-events: none;
}

/* ── Mode toggle (2D/3D) ─────────────────── */
.vp-mode-bar {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 10;
}
.vp-mode {
  display: flex;
  background: rgba(14,17,22,0.85);
  backdrop-filter: blur(8px);
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 3px;
}
.vp-mode-btn {
  padding: 6px 16px;
  border-radius: 7px;
  font-weight: 600;
  font-size: 0.88rem;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.vp-mode-btn.active {
  background: var(--accent);
  color: #fff;
}

/* ── Floating bottom sheet ─────────────── */
.bottom-sheet {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.sheet-toggle {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  font-size: 1.2rem;
  border: 1px solid var(--border);
  background: rgba(14,17,22,0.88);
  backdrop-filter: blur(10px);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sheet-toggle:hover { background: var(--panel-2); }
.sheet-tabs {
  display: none;
  margin-top: 6px;
  background: rgba(14,17,22,0.92);
  backdrop-filter: blur(12px);
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 6px;
  gap: 4px;
  align-items: center;
}
.sheet-tabs.open { display: flex; flex-wrap: wrap; justify-content: center; max-width: 92vw; }
.sheet-tab {
  padding: 9px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.92rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.sheet-tab:hover { color: var(--text); background: var(--panel); }
.sheet-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.status {
  margin-left: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.status.ready { color: var(--ok); border-color: rgba(211,145,66,0.4); }
.status.missing { color: var(--warn); border-color: rgba(240,180,41,0.35); }

/* ── Auth toggle ──────────────────────── */
.vsep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 4px;
  align-self: center;
}
.auth-toggle {
  margin-left: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}
.auth-toggle:hover { color: var(--text); background: var(--panel); }
.auth-toggle.authed { color: var(--ok); border-color: rgba(211,145,66,0.4); }

/* ── Auth modal ──────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  padding: 22px;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.modal-head h3 { margin: 0; color: var(--text); font-size: 1.1rem; }
.modal .field { margin-bottom: 10px; }
.modal .field label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 0.85rem; }
.modal .field input {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.92rem;
}
.modal .field input:focus { outline: none; border-color: var(--accent); }
.modal .row { display: flex; gap: 8px; margin-top: 6px; }
.modal .hint { margin-top: 10px; }
.modal .auth-active { margin-bottom: 10px; }
.btn.hidden { display: none; }

/* ── Floating panels ────────────────── */
.floating-panels {
  position: fixed;
  inset: 0;
  z-index: 15;
  pointer-events: none;
}
.panel {
  display: none;
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  overflow: hidden;
  flex-direction: column;
  pointer-events: auto;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(111,139,255,0.08);
}
.panel.active { display: flex; }

/* ── Per-panel sizing ──────────────────── */
#panel-generate, #panel-script, #panel-animate, #panel-video, #panel-settings {
  max-height: calc(100vh - 150px);
  min-height: 0;
}
#panel-generate {
  width: min(920px, 94vw);
}
#panel-script {
  width: min(680px, 90vw);
}
#panel-animate {
  width: min(1000px, 94vw);
}
#panel-video {
  width: min(880px, 94vw);
}
#panel-settings {
  width: min(720px, 90vw);
}

/* ── Settings popup window ─────────────── */
#settings-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 5;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
  pointer-events: auto;
}
body.settings-open .floating-panels { z-index: 9998; }
body.settings-open #settings-backdrop { display: block; }
body.settings-open #panel-settings {
  position: fixed;
  inset: 0;
  z-index: 10;
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
  box-shadow: none;
  top: 0;
  left: 0;
  bottom: auto;
  transform: none;
}
body.settings-open #panel-settings .panel-resize,
body.settings-open #panel-settings .panel-resize-right,
body.settings-open #panel-settings .panel-resize-left { display: none; }

/* ── Panel resize handles ─────────────── */
.panel-resize {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  z-index: 5;
}
.panel-resize::before {
  content: "";
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  opacity: 0.4;
  transition: opacity 0.15s;
}
.panel-resize:hover::before { opacity: 0.8; }
.panel-resize-right {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 100%;
  cursor: ew-resize;
  z-index: 5;
}
.panel-resize-right::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 2px;
  width: 2px;
  height: 32px;
  transform: translateY(-50%);
  background: var(--muted);
  border-radius: 1px;
  opacity: 0.25;
  transition: opacity 0.15s;
}
.panel-resize-right:hover::before { opacity: 0.6; }
.panel-resize-left {
  position: absolute;
  top: 0;
  left: 0;
  width: 8px;
  height: 100%;
  cursor: ew-resize;
  z-index: 5;
}
.panel-resize-left::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 2px;
  width: 2px;
  height: 32px;
  transform: translateY(-50%);
  background: var(--muted);
  border-radius: 1px;
  opacity: 0.25;
  transition: opacity 0.15s;
}
.panel-resize-left:hover::before { opacity: 0.6; }
.panel.panel-resizing { user-select: none; }
.panel.panel-resizing .panel-inner { pointer-events: none; }

.panel-inner {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}
.panel-head {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -16px -16px 12px;
  padding: 14px 16px 12px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}
.panel-head h2 { margin: 0; font-size: 1.15rem; }
.panel-close {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.panel-close:hover { background: var(--panel-2); color: var(--text); }

/* ── Cards / Form ──────────────────────── */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}
.card-title { margin: 0 0 12px; font-size: 1.05rem; }
.card-sub {
  margin: 16px 0 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.field { margin-bottom: 10px; display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 0.85rem; color: var(--muted); font-weight: 500; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: 16px; }
.grid.split { grid-template-columns: 1fr 1fr; }
.grid.fields4 { grid-template-columns: repeat(4, 1fr); }
.hint {
  padding: 10px;
  font-size: 0.88rem;
  color: var(--muted);
  border-radius: 8px;
  background: var(--bg-soft);
}
.hint.warn { color: var(--warn); background: rgba(240,180,41,0.08); }
.warn { color: var(--warn); }
.danger { background: rgba(248,81,73,0.06); border-color: rgba(248,81,73,0.2); }
.export-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.export-row .field { min-width: 130px; }

/* ── Gallery ────────────────────────────── */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.gallery:empty::after {
  content: "Generate something and it will appear here.";
  color: var(--muted);
  font-size: 0.85rem;
  padding: 20px;
  text-align: center;
  grid-column: 1 / -1;
}
.gallery-item {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel);
}
.gallery-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}
.gallery-item .bar {
  display: flex;
  gap: 5px;
  padding: 5px;
  background: var(--bg-soft);
}
.gallery-item .bar .mini-btn { flex: 1; }

/* ── Scene / Object editor ───────────────── */
.scene-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}
.scene-row:hover { background: var(--bg-soft); }
.scene-row.sel {
  background: var(--panel-2);
  border-color: var(--border-hi);
}
.sr-name { flex: 1; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-ctl { display: flex; gap: 5px; }
.vfx-tag {
  font-size: 0.78rem;
  color: var(--accent);
  background: rgba(111,139,255,0.12);
  border: 1px solid rgba(111,139,255,0.3);
  border-radius: 999px;
  padding: 1px 8px;
  white-space: nowrap;
}
.src-thumb {
  height: 52px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel);
}
.bg-preview {
  margin-top: 8px;
  padding: 12px;
  border-radius: 8px;
  background: var(--bg-soft);
  text-align: center;
}
.kf-list, .mcp-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 8px 0;
}
.kf-chip, .mcp-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.88rem;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
}
.kf-chip:hover, .mcp-chip:hover { background: var(--bg-soft); }
.kf-chip.active { background: var(--panel-2); border-color: var(--accent); }
.kf-editor {
  padding: 10px;
  border-radius: 8px;
  background: var(--bg-soft);
  font-size: 0.88rem;
}
.kf-editor .row { gap: 8px; margin-top: 8px; }
.kf-editor input { width: 76px; }
.kf-editor label { font-size: 0.82rem; color: var(--muted); }
/* ── MCP tools ───────────────────────────── */
.mcp-tool {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
  margin-bottom: 6px;
}
.mcp-tool .row { gap: 6px; }
.mcp-tool .mcp-input { flex: 1; min-width: 0; }
.mcp-tool-out {
  padding: 8px;
  border-radius: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 180px;
  overflow: auto;
}
.mcp-tool-out .row { flex-wrap: wrap; }
#mcp-tools-card .card-head { gap: 10px; }
#mcp-tools-card .card-title { margin: 0; }
.preview-box {
  border-radius: 10px;
  background: var(--panel);
  overflow: hidden;
  border: 1px solid var(--border);
}
.preview-box canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
}
/* ── Checkerboard pattern (behind preview canvases) ── */
.checker {
  background-image:
    linear-gradient(45deg, #1a1e26 25%, transparent 25%),
    linear-gradient(-45deg, #1a1e26 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1a1e26 75%),
    linear-gradient(-45deg, transparent 75%, #1a1e26 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-color: #141820;
}
/* ── Animation controls inside preview ─────────────── */
.preview-box.alt { background: #0b0e13; }
.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
}
.controls label { font-size: 0.85rem; color: var(--muted); }

/* ── Video cards / providers ─────────────── */
.segment {
  display: flex;
  background: var(--bg-soft);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.segment .seg-btn {
  flex: 1;
  padding: 7px 14px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.88rem;
}
.segment .seg-btn.active { background: var(--accent); color: #fff; }
.provider-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  margin-bottom: 8px;
}
.provider-card .pc-name { flex: 1; font-size: 0.92rem; font-weight: 500; }
.provider-card .pc-status { font-size: 0.8rem; color: var(--muted); }
.provider-card .pc-status.ok { color: var(--ok); }

/* ── Video cards ─────────────────────────── */
.video-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel);
}
.video-card .vc-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 10px 10px 0 0;
}
.video-card .vc-info {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.video-card .vc-name { font-size: 0.88rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-card .vc-meta { font-size: 0.78rem; color: var(--muted); }
.video-card .vat { display: flex; gap: 6px; }
.video-card .vat .mini-btn { flex: 1; padding: 6px 10px; }
.video-card .vat .mv-del { flex: 0 0 auto; }
.gallery-item video { width: 100%; height: 100%; object-fit: cover; flex: 1; background: #000; }

/* ── Script editor ─────────────────────────── */
#script-editor {
  width: 100%;
  min-height: 300px;
  background: #0b0e13;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.6;
  resize: vertical;
}
#script-editor:focus { border-color: var(--border-hi); outline: none; }

/* ── Project selector ──────────────────────── */
#project-select {
  min-width: 0;
  font-size: 0.9rem;
}

/* ── Project list ─────────────────────────── */
.project-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
}
.project-list:empty { display: none; }
.project-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.project-item:hover { background: var(--bg-soft); }
.project-item.active {
  background: var(--panel-2);
  border-color: var(--accent);
}
.project-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.project-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.project-item-info {
  min-width: 0;
  flex: 1;
}
.project-item-name {
  font-weight: 500;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-item-desc {
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-item-actions {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}
.project-rename-input {
  font-weight: 500;
  font-size: 0.92rem;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--accent);
  background: var(--panel);
  color: var(--text);
  width: 100%;
  min-width: 0;
}

/* ── Custom model chips ──────────────────── */
.custom-models-section { margin-top: 4px; }
.custom-model-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.model-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
}
.chip-rm {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
  padding: 0 2px;
  line-height: 1;
}
.chip-rm:hover { color: var(--error); }

/* ── Long-form video card ──────────────────── */
.long-video-card {
  border-color: rgba(111,139,255,0.25);
  background: linear-gradient(135deg, var(--panel) 0%, rgba(111,139,255,0.04) 100%);
}
.long-progress {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.long-progress-bar {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: var(--bg-soft);
  overflow: hidden;
  border: 1px solid var(--border);
}
.long-progress-fill {
  width: 0%;
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s ease;
}
.long-progress-text {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ── Responsive ─────────────────────────────── */
@media (max-width: 1080px) {
  .grid.split { grid-template-columns: 1fr; }
  .grid.fields4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .panel { border-radius: 12px; }
  .panel-inner { padding: 10px; }
  .panel-head { margin: -10px -10px 10px; padding: 12px 10px; }
  .vp-controls { padding: 8px 12px; gap: 6px; flex-wrap: wrap; justify-content: center; }
  .bottom-sheet { bottom: 8px; }
}
