/* DJ Armas Studios: editor chrome */
:root {
  --bg: #0d1015;
  --bg-2: #141922;
  --panel: #171d27;
  --panel-2: #1d2531;
  --line: #263041;
  --text: #e8edf4;
  --muted: #94a2b5;
  --accent: #ff2e7e;
  --accent-2: #35e0e5;
  --good: #38d39f;
  --warn: #ffc247;
  --radius: 12px;
  --shadow: 0 18px 44px rgba(0,0,0,.42);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body.app {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 14px; line-height: 1.45; overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.02em; }
h2 { font-size: 13px; margin: 0; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
h3 { font-size: 14px; margin: 0 0 8px; }
p { margin: 0; }
.muted { color: var(--muted); font-size: 13px; }
a { color: var(--accent-2); }

/* ------------------------------------------------------------- topbar */
.topbar {
  height: 56px; display: flex; align-items: center; gap: 16px; padding: 0 16px;
  background: linear-gradient(180deg, #171d27, #12171f);
  border-bottom: 1px solid var(--line); position: relative; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: -0.02em;
  color: var(--text); text-decoration: none; font-size: 16px; }
.brand .mark {
  width: 20px; height: 20px; border-radius: 6px;
  background: conic-gradient(from 200deg, var(--accent), #a05cff, var(--accent-2), var(--accent));
  box-shadow: 0 0 18px rgba(255,46,126,.45);
}
.topbar-project { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.title-input {
  background: transparent; border: 1px solid transparent; color: var(--text);
  font: 600 15px/1.2 var(--font); padding: 7px 10px; border-radius: 8px; min-width: 140px; max-width: 320px;
}
.title-input:hover { border-color: var(--line); }
.title-input:focus { outline: none; border-color: var(--accent); background: var(--bg-2); }
.mini-select, select, input[type=text], input[type=number], input[type=email], input[type=password], textarea {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 8px 10px; font: 500 13px/1.3 var(--font);
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 74px; width: 100%; line-height: 1.5; }
.save-state { color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* -------------------------------------------------------------- buttons */
.btn {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 13px; font: 600 13px/1 var(--font); cursor: pointer;
  transition: .14s ease; white-space: nowrap;
}
.btn:hover { border-color: #3a4557; transform: translateY(-1px); }
.btn:active { transform: none; }
.btn.primary { background: linear-gradient(180deg, #ff4f92, #ef1f6c); border-color: #ff6ea6; color: #180510; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.tiny { padding: 6px 9px; font-size: 12px; border-radius: 8px; }
.btn.icon { width: 34px; height: 34px; padding: 0; display: grid; place-items: center; border-radius: 50%; }
.btn.round { width: 40px; height: 40px; border-radius: 50%; padding: 0; font-size: 15px;
  background: var(--accent); color: #180510; border-color: #ff6ea6; }
.btn.danger { color: #ff9c8c; border-color: #5a2f2a; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.row-gap { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ---------------------------------------------------------------- shell */
.shell { display: flex; height: calc(100vh - 56px); }
.rail {
  width: 92px; flex: none; background: #10151d; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 10px 8px; gap: 4px;
}
.rail-btn {
  background: transparent; border: 0; color: var(--muted); font: 600 11px/1.3 var(--font);
  padding: 10px 4px; border-radius: 10px; cursor: pointer; display: grid; gap: 4px; justify-items: center;
}
.rail-btn .ico { font-size: 17px; }
.rail-btn:hover { background: #161d27; color: var(--text); }
.rail-btn.is-active { background: rgba(255,46,126,.14); color: var(--accent); }

.view { flex: 1; display: none; overflow: auto; }
.view.is-active { display: flex; }
#view-editor.is-active { display: grid; grid-template-columns: 250px minmax(0,1fr) 330px; overflow: hidden; }
#view-characters.is-active, #view-brand.is-active, #view-assets.is-active,
#view-renders.is-active, #view-projects.is-active, #view-music.is-active {
  display: block; padding: 24px 28px 60px; overflow: auto;
}
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; }

/* ------------------------------------------------------------- editor */
.scenes-pane { border-right: 1px solid var(--line); background: #10151d; display: flex; flex-direction: column; min-height: 0; }
.pane-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 10px; border-bottom: 1px solid var(--line); }
.pane-foot { border-top: 1px solid var(--line); padding: 8px 12px; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; }
.scene-list { list-style: none; margin: 0; padding: 8px; overflow: auto; flex: 1; display: grid; gap: 8px; align-content: start; }
.scene-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 9px 10px;
  cursor: pointer; display: grid; gap: 5px; position: relative; transition: .14s;
}
.scene-card:hover { border-color: #3a4557; }
.scene-card.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(255,46,126,.35); }
.scene-card .sc-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.scene-card .sc-beat { font-weight: 700; font-size: 12px; }
.scene-card .sc-line { color: var(--muted); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.scene-card .sc-meta { display: flex; gap: 6px; font-size: 11px; color: #6f8098; }
.scene-card .sc-drag { cursor: grab; color: #4d5b70; }
.scene-card.dragging { opacity: .5; }

.stage-pane { display: flex; flex-direction: column; min-width: 0; background: #0b0e13; }
.stage-wrap { flex: 1; display: grid; place-items: center; padding: 18px; min-height: 0; }
.stage-box { position: relative; box-shadow: var(--shadow); border-radius: 10px; overflow: hidden; background: #000;
  max-width: 100%; max-height: 100%; }
.stage-box canvas { display: block; max-width: 100%; max-height: calc(100vh - 260px); width: auto; height: auto; }
.stage-badge { position: absolute; top: 10px; left: 10px; background: rgba(10,13,18,.68); color: #fff;
  padding: 4px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; backdrop-filter: blur(6px); }
.transport { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); background: #10151d; }
.time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; min-width: 92px; }
.scrub { flex: 1; accent-color: var(--accent); }
.timeline-strip { display: flex; gap: 3px; padding: 0 16px 12px; background: #10151d; }
.strip-seg { height: 26px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line);
  font-size: 10px; color: var(--muted); display: grid; place-items: center; overflow: hidden; cursor: pointer;
  white-space: nowrap; padding: 0 6px; }
.strip-seg.is-active { background: rgba(255,46,126,.2); border-color: var(--accent); color: var(--text); }

.inspector { border-left: 1px solid var(--line); background: #10151d; display: flex; flex-direction: column; min-height: 0; }
.inspector-body { overflow: auto; padding: 12px; display: grid; gap: 14px; align-content: start; }
.field { display: grid; gap: 5px; }
.field > label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field select, .field input[type=text], .field input[type=number] { width: 100%; }
.pill { background: rgba(53,224,229,.14); color: var(--accent-2); border-radius: 20px; padding: 3px 9px; font-size: 11px; font-weight: 700; }
.section-title { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: #6f8098; font-weight: 700;
  border-top: 1px solid var(--line); padding-top: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--panel-2); border: 1px solid var(--line); border-radius: 20px; padding: 5px 10px;
  font-size: 12px; cursor: pointer; }
.chip.is-active { background: rgba(255,46,126,.16); border-color: var(--accent); color: var(--accent); }
input[type=range] { accent-color: var(--accent); width: 100%; }
input[type=color] { width: 100%; height: 34px; padding: 2px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; }
.switch { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
.hint { font-size: 11px; color: #6f8098; }

/* ---------------------------------------------------------------- cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; }
.card .thumb { aspect-ratio: 4/3; background: #0f141c; display: grid; place-items: center; overflow: hidden; }
.card.character .thumb { aspect-ratio: 4/5; }
.card .thumb canvas, .card .thumb img, .card .thumb video { width: 100%; height: 100%; object-fit: contain; }
.card .body { padding: 10px 12px; display: grid; gap: 4px; }
.card .body strong { font-size: 14px; }
.card .actions { display: flex; gap: 6px; padding: 0 12px 12px; flex-wrap: wrap; }
.empty { border: 1px dashed var(--line); border-radius: var(--radius); padding: 34px; text-align: center; color: var(--muted); }

.panel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: grid; gap: 12px; min-width: 0; }
.panel * { min-width: 0; }

/* --------------------------------------------------------------- modal */
.modal-root { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; }
.modal-root[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5,8,12,.66); backdrop-filter: blur(3px); }
.modal {
  position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 60px); display: flex; flex-direction: column;
  box-shadow: var(--shadow);
}
.modal.narrow { width: min(520px, calc(100vw - 32px)); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 16px; text-transform: none; letter-spacing: -0.01em; color: var(--text); }
.modal-body { padding: 18px; overflow: auto; }
.modal-foot { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.tab { background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 9px;
  padding: 7px 12px; cursor: pointer; font: 600 13px var(--font); }
.tab.is-active { background: rgba(255,46,126,.14); border-color: var(--accent); color: var(--accent); }
.two-col { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.preview-card { background: #0f141c; border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: grid; gap: 10px; }
.preview-card canvas { width: 100%; border-radius: 8px; background: #10161f; }
.form-grid { display: grid; gap: 12px; }
.anchor-stage { position: relative; border-radius: 10px; overflow: hidden; background: #0f141c; }
.anchor-stage img { width: 100%; display: block; }
.anchor-dot { position: absolute; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff;
  background: rgba(255,46,126,.75); transform: translate(-50%, -50%); cursor: grab; box-shadow: 0 2px 8px rgba(0,0,0,.5);
  display: grid; place-items: center; font-size: 9px; color: #fff; font-weight: 700; }
.progress { height: 8px; background: var(--bg-2); border-radius: 20px; overflow: hidden; border: 1px solid var(--line); }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #ffa268); width: 0; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: #1d2531; border: 1px solid var(--line); color: var(--text); padding: 10px 16px;
  border-radius: 10px; box-shadow: var(--shadow); z-index: 80; font-size: 13px;
}
.toast.bad { border-color: #6b3630; color: #ffb3a5; }

.badge { display: inline-block; background: var(--panel-2); border: 1px solid var(--line); border-radius: 20px;
  padding: 2px 8px; font-size: 11px; color: var(--muted); }
.kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 5px; font-size: 11px; }

@media (max-width: 1180px) {
  #view-editor.is-active { grid-template-columns: 210px minmax(0,1fr) 300px; }
}
@media (max-width: 940px) {
  body.app { overflow: auto; }
  .shell { flex-direction: column; height: auto; }
  .rail { width: 100%; flex-direction: row; overflow-x: auto; }
  #view-editor.is-active { grid-template-columns: 1fr; }
  .scenes-pane, .inspector { border: 0; border-top: 1px solid var(--line); }
  .stage-box canvas { max-height: 52vh; }
  .two-col { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------ music video */
.tpl-row { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line); }
.tpl-row:last-of-type { border-bottom: 0; }
.tpl-row strong { font-size: 14px; }
.beatmap { width: 100%; height: 74px; border-radius: 9px; border: 1px solid var(--line); background: #0f141c; }
.lyric-list { display: grid; gap: 6px; max-height: 260px; overflow: auto; padding-right: 4px; }
.lyric-row { display: grid; grid-template-columns: 44px 1fr 74px 32px; gap: 6px; align-items: center; }
.lyric-row input[type=text] { width: 100%; }
.lyric-time { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.grid-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-two .btn { padding: 18px; font-size: 15px; }

/* ------------------------------------------------------------- film mode */
#view-film.is-active, #view-storyboard.is-active, #view-audio.is-active {
  display: block; padding: 24px 28px 60px; overflow: auto;
}
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.board-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; }
.board-thumb { aspect-ratio: 16/9; background: #0b0e14; display: grid; place-items: center; overflow: hidden; }
.board-thumb img { width: 100%; height: 100%; object-fit: cover; }
.board-body { padding: 12px 14px; display: grid; gap: 8px; }
.board-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ref-empty { color: #5d6a7d; font-size: 12px; padding: 26px 14px; text-align: center; }
.ref-slot { background: #0b0e14; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  display: grid; place-items: center; min-height: 90px; }
.ref-slot img { width: 100%; display: block; }
.prompt-box summary { cursor: pointer; font-size: 12px; color: var(--muted); font-weight: 600; }
.prompt-box textarea { margin-top: 8px; font-size: 12px; }
.shot-thumb { background: #0b0e14; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  aspect-ratio: 16/9; display: grid; place-items: center; }
.shot-thumb img { width: 100%; height: 100%; object-fit: cover; }
.track-row { display: grid; grid-template-columns: 1.4fr 0.8fr 0.8fr 0.8fr auto; gap: 10px; align-items: end;
  padding: 10px 0; border-bottom: 1px solid var(--line); }
.track-row:last-child { border-bottom: 0; }
@media (max-width: 900px) { .track-row { grid-template-columns: 1fr 1fr; } }
