/* tik.rab46.ru — нарезка клипов. Тёмная тема, системные шрифты, без CDN. */
:root {
  --bg: #0e1014;
  --bg2: #151922;
  --bg3: #1d2330;
  --line: #29303f;
  --text: #e8ecf4;
  --muted: #8b93a7;
  --accent: #7c5cff;
  --accent2: #9d86ff;
  --ok: #3ecf8e;
  --danger: #ff5d73;
  --r: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0; }
h2 { font-size: 18px; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.err {
  background: rgba(255, 93, 115, .12); border: 1px solid rgba(255, 93, 115, .4);
  color: #ffb3be; padding: 8px 12px; border-radius: 8px; margin: 8px 0; font-size: 14px;
}

/* шапка */
.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 10px 20px; background: var(--bg2); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.brand { color: var(--text); font-size: 17px; }
.brand span { color: var(--muted); margin-left: 5px; font-weight: 400; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
  color: var(--muted); padding: 6px 14px; border-radius: 8px; font-size: 14px;
}
.topbar nav a:hover { color: var(--text); text-decoration: none; }
.topbar nav a.act { background: var(--bg3); color: var(--text); }
.exit { color: var(--muted); font-size: 13px; }
main { max-width: 1500px; margin: 0 auto; padding: 20px; }

/* кнопки и поля */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg3); color: var(--text); border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 9px; cursor: pointer; font-size: 14px;
  transition: .15s; user-select: none;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent2); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.big { padding: 11px 22px; font-size: 16px; }
.btn.wide { width: 100%; justify-content: center; }
input[type=text], input[type=password], input[type=number], select, textarea {
  background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; font: inherit; max-width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { width: 100%; resize: vertical; }
input[type=color] { width: 40px; height: 32px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); cursor: pointer; }
input[type=range] { accent-color: var(--accent); }
.chk { display: flex; align-items: center; gap: 7px; font-size: 14px; color: var(--text); cursor: pointer; margin: 6px 0; }
.chk input { accent-color: var(--accent); width: 16px; height: 16px; }

/* раскладка */
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 18px; flex-wrap: wrap;
}
.head-actions { display: flex; align-items: center; gap: 12px; }
.row { display: flex; align-items: center; }
.row.gap { gap: 8px; }
.row.wrap { flex-wrap: wrap; row-gap: 10px; }
.row-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.panel {
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px; margin-bottom: 14px;
}
.panel.narrow { max-width: 640px; }
.panel-title { font-weight: 600; margin-bottom: 12px; font-size: 15px; }
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.proj-layout { display: grid; grid-template-columns: 400px 1fr; gap: 16px; align-items: start; }
.proj-name {
  font-size: 21px; font-weight: 700; background: transparent; border: 1px solid transparent;
  border-radius: 8px; padding: 4px 8px; color: var(--text); min-width: 200px; flex: 1;
}
.proj-name:hover, .proj-name:focus { border-color: var(--line); background: var(--bg2); }

/* карточки проектов */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.pc-preview { display: block; aspect-ratio: 9/14; background: #000; position: relative; }
.pc-preview video { width: 100%; height: 100%; object-fit: cover; }
.pc-noprev { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }
.pc-body { padding: 12px; }
.pc-name { font-weight: 600; color: var(--text); display: block; margin-bottom: 4px; }
.pc-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

/* библиотека */
.lib-section { margin-bottom: 28px; }
.lib-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.lib-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.drop-zone {
  border: 2px dashed var(--line); border-radius: var(--r); padding: 18px;
  text-align: center; color: var(--muted); margin-bottom: 14px; transition: .15s;
}
.drop-zone.over { border-color: var(--accent); color: var(--accent2); background: rgba(124, 92, 255, .06); }
.upload-status { margin: 10px 0; color: var(--ok); font-size: 14px; }
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.video-grid.compact { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 9px; }
.vcard { position: relative; }
.vthumb {
  position: relative; aspect-ratio: 9/16; border-radius: 10px; overflow: hidden;
  background: #000; cursor: pointer; border: 2px solid transparent;
}
.vthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vdur {
  position: absolute; right: 5px; bottom: 5px; background: rgba(0,0,0,.75);
  padding: 1px 6px; border-radius: 6px; font-size: 11.5px;
}
.vcheck {
  position: absolute; left: 6px; top: 6px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff; display: none; align-items: center;
  justify-content: center; font-size: 13px; font-weight: 700;
}
.vcard.sel .vthumb, .vcard.pick.sel .vthumb { border-color: var(--accent); }
.vcard.sel .vcheck { display: flex; }
.vplay {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(0,0,0,.6); color: #fff; font-size: 15px; opacity: 0; transition: .15s;
}
.vthumb:hover .vplay { opacity: 1; }
.vname { font-size: 12.5px; margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vtags { width: 100%; margin-top: 4px; font-size: 12px; padding: 4px 8px; }
.music-list { display: flex; flex-direction: column; gap: 8px; }
.mrow {
  display: flex; align-items: center; gap: 12px; background: var(--bg3);
  border-radius: 10px; padding: 8px 12px; flex-wrap: wrap;
}
.mrow.pickable { cursor: pointer; }
.mrow input[type=radio] { accent-color: var(--accent); width: 17px; height: 17px; }
.mname { flex: 1; min-width: 120px; font-size: 14px; }
.mrow audio { height: 32px; max-width: 260px; }

/* рендеры */
.render-item { background: var(--bg3); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.render-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.render-title { font-weight: 600; font-size: 14px; }
.rstatus { font-size: 13px; padding: 2px 9px; border-radius: 20px; }
.rstatus.done { background: rgba(62, 207, 142, .15); color: var(--ok); }
.rstatus.running, .rstatus.queued { background: rgba(124, 92, 255, .18); color: var(--accent2); }
.rstatus.error { background: rgba(255, 93, 115, .15); color: var(--danger); }
.rstatus.canceled { background: var(--bg); color: var(--muted); }
.pbar { height: 7px; background: var(--bg); border-radius: 5px; overflow: hidden; margin: 9px 0; }
.pbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .5s; }
.render-video { width: 100%; max-width: 300px; border-radius: 10px; margin: 8px 0; background: #000; }
.render-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.rlog {
  background: var(--bg); border-radius: 8px; padding: 8px 10px; font: 12px/1.5 ui-monospace, monospace;
  color: var(--muted); white-space: pre-wrap; max-height: 160px; overflow: auto; margin-top: 8px;
}

/* вход */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.login-card {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 16px;
  padding: 34px; width: 340px; text-align: center;
}
.login-logo { font-size: 42px; }
.login-card h1 { font-size: 22px; margin: 8px 0 2px; }
.login-card p { margin: 0 0 18px; font-size: 13.5px; }
.login-card input { width: 100%; margin-bottom: 12px; text-align: center; }

/* модалка предпросмотра */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.75); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { background: var(--bg2); border-radius: 14px; padding: 14px; max-width: 420px; width: 100%; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 14px; gap: 10px; }
.modal-box video { width: 100%; max-height: 72vh; border-radius: 10px; background: #000; }

/* уведомления */
#toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast-msg {
  background: var(--bg3); border: 1px solid var(--accent); border-radius: 10px;
  padding: 10px 18px; font-size: 14px; animation: tin .2s; box-shadow: 0 6px 24px rgba(0,0,0,.4);
}
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }

.empty { padding: 30px 10px; text-align: center; color: var(--muted); }

.code-box {
  font: 700 20px/1 ui-monospace, monospace; letter-spacing: 2px;
  background: var(--bg); border: 1px dashed var(--accent); color: var(--accent2);
  padding: 10px 16px; border-radius: 10px; user-select: all;
}

@media (max-width: 1000px) {
  .proj-layout { grid-template-columns: 1fr; }
  main { padding: 12px 16px; }
  .topbar { padding: 8px 12px; gap: 10px; }
  .mrow audio { max-width: 100%; }
}
