:root {
  --bg: #070a10;
  --bg-2: #0a0e16;
  --panel: #0c111b;
  --panel-2: #101624;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.09);
  --border-2: rgba(255, 255, 255, 0.16);

  --cyan: #00e7d8;
  --cyan-2: #18b6ff;
  --coral: #ff3b66;
  --coral-2: #ff7a59;
  --emerald: #1fd6a3;
  --amber: #ffc24b;
  --red: #ff5470;
  --violet: #9d7bff;

  --grad: linear-gradient(120deg, var(--cyan) 0%, var(--cyan-2) 100%);
  --grad-coral: linear-gradient(120deg, var(--coral) 0%, var(--coral-2) 100%);

  --text: #eef2f8;
  --muted: #8b95a7;
  --muted-2: #5d6678;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 50px -18px rgba(0, 0, 0, 0.7);
  --glow-cyan: 0 0 0 1px rgba(0, 231, 216, 0.25), 0 12px 40px -12px rgba(0, 231, 216, 0.35);

  --track-h: 56px;
  --ruler-h: 26px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background:
    radial-gradient(90% 60% at 70% -10%, rgba(24, 182, 255, 0.08), transparent 60%),
    radial-gradient(70% 50% at 10% 110%, rgba(255, 59, 102, 0.06), transparent 60%),
    var(--bg);
  color: var(--text);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
h1, h2, h3, b { font-family: 'Space Grotesk', 'Inter', sans-serif; }
svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
input, select, textarea, button { font-family: inherit; font-size: 13px; color: inherit; }
::selection { background: rgba(0, 231, 216, 0.3); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); background-clip: content-box; border: 2px solid transparent; }
::-webkit-scrollbar-corner, ::-webkit-scrollbar-track { background: transparent; }

/* ==================== LAYOUT ==================== */
.studio {
  display: grid;
  grid-template-rows: 52px 1fr auto;
  height: 100vh;
  gap: 0;
}
.ed-mid {
  display: grid;
  grid-template-columns: 296px 1fr 318px;
  min-height: 0;
  gap: 10px;
  padding: 10px;
  padding-bottom: 0;
}

/* ==================== TOP BAR ==================== */
.ed-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: rgba(10, 14, 22, 0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  z-index: 30;
}
.ed-top-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ed-back {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: 0.15s;
}
.ed-back:hover { color: var(--text); border-color: var(--border-2); }
.ed-back svg { width: 16px; height: 16px; }
.ed-brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.ed-brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--grad);
  display: grid; place-items: center;
  color: #04252b;
  box-shadow: var(--glow-cyan);
  flex: none;
}
.ed-brand-mark svg { width: 19px; height: 19px; stroke-width: 2.2; }
.ed-brand-text { display: flex; flex-direction: column; min-width: 0; }
.proj-name {
  background: transparent; border: 1px solid transparent; border-radius: 7px;
  font-family: 'Space Grotesk'; font-weight: 600; font-size: 14.5px;
  padding: 1px 7px; margin-left: -7px; width: 230px;
  transition: 0.15s;
}
.proj-name:hover { border-color: var(--border); }
.proj-name:focus { outline: none; border-color: rgba(0, 231, 216, 0.4); background: rgba(0,0,0,0.3); }
.save-status { font-size: 10.5px; color: var(--muted-2); padding-left: 1px; }
.save-status.saving { color: var(--amber); }
.save-status.saved { color: var(--emerald); }

.ed-top-center { display: flex; align-items: center; gap: 6px; }
.ed-top-right { display: flex; align-items: center; gap: 8px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  font-weight: 600; cursor: pointer; transition: 0.16s;
  text-decoration: none;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-2); }
.btn svg { width: 15px; height: 15px; }
.btn.primary {
  background: var(--grad); color: #03272c; border: none;
}
.btn.primary:hover { filter: brightness(1.1); }
.btn.primary.glow { box-shadow: var(--glow-cyan); }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: 0.45; pointer-events: none; }

.tbtn {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: var(--muted); cursor: pointer;
  display: grid; place-items: center; transition: 0.14s; flex: none;
}
.tbtn svg { width: 16px; height: 16px; }
.tbtn:hover { background: var(--surface-2); color: var(--text); }
.tbtn:disabled { opacity: 0.35; pointer-events: none; }
.tbtn.danger:hover { color: var(--red); background: rgba(255, 84, 112, 0.12); }
.tbtn.tog.active { color: var(--cyan); background: rgba(0, 231, 216, 0.1); border-color: rgba(0, 231, 216, 0.25); }
.tbtn.play {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--grad); color: #03272c;
  box-shadow: 0 6px 20px -6px rgba(0, 231, 216, 0.5);
}
.tbtn.play:hover { filter: brightness(1.12); color: #03272c; }
.tbtn.play svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.tsep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.tsel {
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px;
  padding: 6px 9px; cursor: pointer;
}
.tsel:hover { border-color: var(--border-2); }
.tsel option { background: var(--panel-2); }

/* ==================== LEFT PANEL ==================== */
.ed-left {
  display: flex; flex-direction: column; min-height: 0;
  background: rgba(12, 17, 27, 0.75);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
  backdrop-filter: blur(10px);
}
.ed-tabs {
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 7px; gap: 4px;
  border-bottom: 1px solid var(--border);
}
.ed-tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 2px; border-radius: 9px; border: none; background: transparent;
  color: var(--muted); cursor: pointer; font-size: 10.5px; font-weight: 600;
  transition: 0.15s;
}
.ed-tab svg { width: 17px; height: 17px; }
.ed-tab:hover { color: var(--text); background: var(--surface); }
.ed-tab.active { color: var(--cyan); background: rgba(0, 231, 216, 0.09); }
.ed-pane { display: none; flex: 1; overflow-y: auto; padding: 10px; min-height: 0; }
.ed-pane.active { display: block; }

.drop-zone {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 16px 10px; margin-bottom: 10px;
  border: 1.5px dashed var(--border-2); border-radius: var(--radius-sm);
  color: var(--muted); cursor: pointer; text-align: center; transition: 0.18s;
}
.drop-zone svg { width: 22px; height: 22px; margin-bottom: 3px; }
.drop-zone b { color: var(--text); font-size: 12.5px; }
.drop-zone span { font-size: 11px; }
.drop-zone:hover, .drop-zone.over { border-color: var(--cyan); color: var(--cyan); background: rgba(0, 231, 216, 0.05); }
.drop-zone.small { padding: 10px; flex-direction: row; gap: 8px; }

/* импорт по ссылке */
.link-import { margin-bottom: 10px; }
.link-row {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 9px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: linear-gradient(120deg, rgba(0, 231, 216, 0.06), rgba(24, 182, 255, 0.03)), var(--surface);
  transition: 0.15s;
}
.link-row:focus-within { border-color: rgba(0, 231, 216, 0.5); }
.link-row svg { width: 16px; height: 16px; color: var(--cyan); flex: none; }
.link-row input {
  flex: 1; min-width: 0; background: transparent; border: none; color: var(--text); font-size: 12px;
}
.link-row input:focus { outline: none; }
.link-row .btn { padding: 5px 11px; border-radius: 8px; }
.link-progress { margin-top: 7px; font-size: 11px; color: var(--muted); }
.link-progress .progress { margin-bottom: 4px; }

.media-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.media-item {
  position: relative; border-radius: var(--radius-sm); overflow: hidden;
  border: 1px solid var(--border); background: #000;
  aspect-ratio: 4/5; cursor: grab; transition: 0.15s;
}
.media-item:hover { border-color: rgba(0, 231, 216, 0.55); transform: translateY(-1px); }
.media-item:active { cursor: grabbing; }
.media-item img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.media-item .mi-dur {
  position: absolute; right: 5px; bottom: 5px;
  background: rgba(0, 0, 0, 0.72); border-radius: 5px;
  font-size: 10px; padding: 1.5px 5px; font-weight: 600;
  pointer-events: none;
}
.media-item .mi-kind {
  position: absolute; left: 5px; top: 5px; width: 20px; height: 20px;
  border-radius: 5px; background: rgba(0,0,0,0.65); color: var(--cyan);
  display: grid; place-items: center; pointer-events: none;
}
.media-item .mi-kind svg { width: 12px; height: 12px; }
.media-item .mi-name {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 14px 6px 4px; font-size: 10px; color: rgba(255,255,255,0.9);
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none; opacity: 0; transition: 0.15s;
}
.media-item:hover .mi-name { opacity: 1; }
.media-item.audio { aspect-ratio: auto; height: 52px; display: flex; align-items: center; gap: 8px; padding: 0 10px; background: var(--surface); }
.media-item .mi-add {
  position: absolute; right: 5px; top: 5px; width: 22px; height: 22px;
  border-radius: 6px; border: none; cursor: pointer;
  background: rgba(0, 231, 216, 0.9); color: #03272c;
  display: grid; place-items: center; opacity: 0; transition: 0.15s;
}
.media-item:hover .mi-add { opacity: 1; }
.media-item .mi-add svg { width: 13px; height: 13px; stroke-width: 2.6; }

.audio-list { display: flex; flex-direction: column; gap: 7px; }
.audio-row {
  display: flex; align-items: center; gap: 9px; padding: 9px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); cursor: grab; transition: 0.14s;
}
.audio-row:hover { border-color: rgba(0, 231, 216, 0.5); }
.audio-row .ar-icon {
  width: 30px; height: 30px; flex: none; border-radius: 8px;
  background: rgba(157, 123, 255, 0.16); color: var(--violet);
  display: grid; place-items: center;
}
.audio-row .ar-icon svg { width: 15px; height: 15px; }
.audio-row .ar-meta { min-width: 0; flex: 1; }
.audio-row .ar-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audio-row .ar-dur { font-size: 10.5px; color: var(--muted); }

.text-presets { display: flex; flex-direction: column; gap: 8px; }
.text-preset {
  padding: 14px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer; text-align: center;
  transition: 0.15s; overflow: hidden; white-space: nowrap;
}
.text-preset:hover { border-color: rgba(0, 231, 216, 0.55); background: var(--surface-2); transform: translateY(-1px); }

.sticker-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.sticker-cell {
  aspect-ratio: 1; display: grid; place-items: center; font-size: 26px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: 0.13s;
}
.sticker-cell:hover { transform: scale(1.12); border-color: rgba(0, 231, 216, 0.5); background: var(--surface-2); }

/* ==================== CENTER / PREVIEW ==================== */
.ed-center { display: flex; flex-direction: column; min-width: 0; min-height: 0; gap: 8px; }
.canvas-stage {
  flex: 1; min-height: 0; position: relative;
  display: grid; place-items: center;
  border-radius: var(--radius);
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(24, 182, 255, 0.05), transparent),
    repeating-conic-gradient(rgba(255,255,255,0.02) 0% 25%, transparent 0% 50%) 0 0/22px 22px,
    var(--bg-2);
  border: 1px solid var(--border);
  overflow: hidden;
}
.canvas-holder { position: relative; box-shadow: 0 24px 70px -20px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.07); border-radius: 6px; }
#previewCanvas, #gizmoCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; border-radius: 6px; }
#previewCanvas { position: relative; background: #000; }
#gizmoCanvas { cursor: default; }

.transport {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px;
  background: rgba(12, 17, 27, 0.75); border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
}
.t-time, .t-dur {
  font-family: 'Space Grotesk'; font-variant-numeric: tabular-nums;
  font-size: 13.5px; font-weight: 600; min-width: 74px;
}
.t-time { color: var(--cyan); }
.t-dur { color: var(--muted); text-align: right; min-width: 46px; }
.t-controls { display: flex; align-items: center; gap: 6px; }
.t-right { display: flex; align-items: center; gap: 6px; }

/* ==================== INSPECTOR ==================== */
.ed-right {
  display: flex; flex-direction: column; min-height: 0;
  background: rgba(12, 17, 27, 0.75);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; backdrop-filter: blur(10px);
}
.insp-head {
  padding: 11px 14px; font-family: 'Space Grotesk'; font-weight: 600; font-size: 13px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.insp-body { flex: 1; overflow-y: auto; min-height: 0; }
.insp-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; height: 100%; color: var(--muted-2); text-align: center; font-size: 12px;
  padding: 20px;
}
.insp-empty svg { width: 34px; height: 34px; opacity: 0.6; }

.insp-sec { border-bottom: 1px solid var(--border); }
.insp-sec-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 14px; cursor: pointer; font-weight: 600; font-size: 12px;
  color: var(--text); transition: 0.13s;
}
.insp-sec-head:hover { background: var(--surface); }
.insp-sec-head .chev { width: 14px; height: 14px; color: var(--muted); transition: transform 0.18s; }
.insp-sec.closed .chev { transform: rotate(-90deg); }
.insp-sec.closed .insp-sec-body { display: none; }
.insp-sec-body { padding: 4px 14px 12px; display: flex; flex-direction: column; gap: 9px; }

.prow { display: flex; align-items: center; gap: 8px; }
.prow .plabel { width: 82px; flex: none; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow .pctrl { flex: 1; display: flex; align-items: center; gap: 7px; min-width: 0; }

.kf-btn {
  width: 18px; height: 18px; flex: none; border: none; background: transparent;
  cursor: pointer; display: grid; place-items: center; color: var(--muted-2);
  transition: 0.13s; padding: 0;
}
.kf-btn .diamond {
  width: 9px; height: 9px; transform: rotate(45deg);
  border: 1.4px solid currentColor; border-radius: 2px; transition: 0.13s;
}
.kf-btn:hover { color: var(--cyan); }
.kf-btn.has { color: var(--cyan-2); }
.kf-btn.on { color: var(--cyan); }
.kf-btn.on .diamond { background: currentColor; box-shadow: 0 0 8px rgba(0, 231, 216, 0.7); }

input[type='range'].slider {
  flex: 1; -webkit-appearance: none; appearance: none; height: 4px; border-radius: 3px;
  background: linear-gradient(to right, var(--cyan) var(--fill, 50%), rgba(255,255,255,0.12) var(--fill, 50%));
  cursor: pointer; min-width: 0;
}
input[type='range'].slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%;
  background: #fff; border: 2.5px solid var(--cyan);
  box-shadow: 0 2px 8px rgba(0,0,0,0.5); cursor: grab;
}
.pnum {
  width: 52px; flex: none; background: var(--surface); border: 1px solid var(--border);
  border-radius: 7px; padding: 4px 6px; text-align: right; font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.pnum:focus { outline: none; border-color: rgba(0, 231, 216, 0.5); }

.f-label { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.f-input {
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px;
  padding: 8px 10px; color: var(--text); font-weight: 500; width: 100%;
  resize: vertical;
}
.f-input:focus { outline: none; border-color: rgba(0, 231, 216, 0.5); background: rgba(0,0,0,0.25); }
.f-input option { background: var(--panel-2); }

.seg { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; flex: 1; }
.seg button {
  flex: 1; padding: 5px 2px; border: none; background: transparent; border-radius: 6px;
  color: var(--muted); cursor: pointer; font-size: 10.5px; font-weight: 600; transition: 0.13s;
  display: grid; place-items: center; white-space: nowrap; overflow: hidden;
}
.seg button svg { width: 14px; height: 14px; }
.seg button:hover { color: var(--text); }
.seg button.active { background: rgba(0, 231, 216, 0.16); color: var(--cyan); }

.color-in { width: 30px; height: 26px; border: 1px solid var(--border); border-radius: 7px; background: transparent; padding: 1px; cursor: pointer; flex: none; }

.lut-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.lut {
  aspect-ratio: 1/0.72; border-radius: 8px; border: 1.5px solid var(--border); cursor: pointer;
  position: relative; overflow: hidden; transition: 0.14s;
  display: flex; align-items: flex-end; justify-content: center;
  font-size: 9px; font-weight: 700; color: rgba(255,255,255,0.85);
  padding-bottom: 3px; text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
.lut:hover { transform: translateY(-1px); border-color: var(--border-2); }
.lut.active { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan); }

.speed-presets { display: flex; gap: 4px; }
.speed-presets button {
  flex: 1; padding: 4px 2px; font-size: 10.5px; font-weight: 700;
  background: var(--surface); border: 1px solid var(--border); border-radius: 7px;
  color: var(--muted); cursor: pointer; transition: 0.13s;
}
.speed-presets button:hover { color: var(--text); border-color: var(--border-2); }
.speed-presets button.active { color: var(--cyan); border-color: rgba(0, 231, 216, 0.4); background: rgba(0, 231, 216, 0.08); }

.insp-actions { display: flex; gap: 6px; padding: 12px 14px; }
.insp-actions .btn { flex: 1; padding: 7px 8px; font-size: 12px; }

/* ==================== TIMELINE ==================== */
.ed-bottom {
  margin: 10px; margin-top: 8px;
  background: rgba(12, 17, 27, 0.85);
  border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column;
  height: 262px; min-height: 160px;
  backdrop-filter: blur(12px);
  overflow: hidden;
  position: relative;
}
.tl-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 10px; border-bottom: 1px solid var(--border); flex: none;
}
.tl-tools { display: flex; align-items: center; gap: 3px; }
.tl-zoom { display: flex; align-items: center; gap: 8px; width: 190px; color: var(--muted-2); }
.tl-zoom .zi { width: 13px; height: 13px; flex: none; }
.tl-zoom input { flex: 1; -webkit-appearance: none; height: 3px; border-radius: 2px; background: rgba(255,255,255,0.14); cursor: pointer; }
.tl-zoom input::-webkit-slider-thumb { -webkit-appearance: none; width: 11px; height: 11px; border-radius: 50%; background: var(--cyan); cursor: grab; }

.tl-main { flex: 1; display: flex; min-height: 0; }
.tl-heads {
  width: 138px; flex: none; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
  background: rgba(0,0,0,0.18);
  z-index: 5;
}
.tl-corner { height: var(--ruler-h); flex: none; border-bottom: 1px solid var(--border); }
.tl-head {
  height: var(--track-h); flex: none;
  display: flex; align-items: center; gap: 5px; padding: 0 8px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 11px;
}
.tl-head .th-icon { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; flex: none; }
.tl-head .th-icon svg { width: 13px; height: 13px; }
.tl-head .th-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-weight: 600; }
.tl-head .tbtn { width: 22px; height: 22px; border-radius: 6px; }
.tl-head .tbtn svg { width: 12px; height: 12px; }
.tl-head .tbtn.off { color: var(--coral); }
.tl-add-track {
  margin: 8px; padding: 6px; border-radius: 8px; border: 1px dashed var(--border-2);
  background: transparent; color: var(--muted-2); font-size: 11px; font-weight: 600;
  cursor: pointer; transition: 0.14s;
}
.tl-add-track:hover { color: var(--cyan); border-color: var(--cyan); }

.tl-scroll { flex: 1; overflow: auto; position: relative; min-width: 0; }
.tl-canvas { position: relative; min-width: 100%; }
.tl-ruler {
  position: sticky; top: 0; display: block; height: var(--ruler-h);
  background: rgba(7, 10, 16, 0.95); border-bottom: 1px solid var(--border);
  cursor: ew-resize; z-index: 4;
}
.tl-tracks { position: relative; }
.tl-track {
  height: var(--track-h); position: relative;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.tl-track.drop-hint { background: rgba(0, 231, 216, 0.05); }
.tl-track.audio-lane { background: rgba(157, 123, 255, 0.03); }

.clip {
  position: absolute; top: 5px; bottom: 5px; border-radius: 9px;
  overflow: hidden; cursor: grab;
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  background: #1a2233;
  transition: border-color 0.12s, box-shadow 0.12s;
  contain: strict;
}
.clip:active { cursor: grabbing; }
.clip.selected {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan), 0 6px 20px -6px rgba(0, 231, 216, 0.45);
  z-index: 3;
}
.clip .clip-strip { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0.92; }
.clip .clip-thumbs { position: absolute; inset: 0; display: flex; overflow: hidden; pointer-events: none; }
.clip .clip-thumbs img { height: 100%; flex: none; object-fit: cover; opacity: 0.85; }
.clip .clip-wave { position: absolute; inset: 0; pointer-events: none; opacity: 0.9; }
.clip .clip-label {
  position: absolute; left: 7px; top: 3px; right: 22px;
  font-size: 10px; font-weight: 700; color: rgba(255,255,255,0.95);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9); pointer-events: none;
  display: flex; align-items: center; gap: 4px;
}
.clip .clip-label svg { width: 10px; height: 10px; flex: none; }
.clip.type-video { background: linear-gradient(180deg, #14202e, #101a28); }
.clip.type-image { background: linear-gradient(180deg, #1c2a1e, #14201a); }
.clip.type-text { background: linear-gradient(135deg, rgba(0, 231, 216, 0.2), rgba(24, 182, 255, 0.14)); }
.clip.type-sticker { background: linear-gradient(135deg, rgba(255, 194, 75, 0.2), rgba(255, 122, 89, 0.15)); }
.clip.type-audio { background: linear-gradient(180deg, rgba(157, 123, 255, 0.2), rgba(157, 123, 255, 0.08)); }
.clip .trim {
  position: absolute; top: 0; bottom: 0; width: 9px; cursor: ew-resize; z-index: 2;
  display: grid; place-items: center; opacity: 0; transition: 0.12s;
}
.clip:hover .trim, .clip.selected .trim { opacity: 1; }
.clip .trim::after { content: ''; width: 3px; height: 46%; border-radius: 2px; background: rgba(255,255,255,0.85); }
.clip .trim.l { left: 0; background: linear-gradient(90deg, rgba(0,231,216,0.35), transparent); border-radius: 8px 0 0 8px; }
.clip .trim.r { right: 0; background: linear-gradient(-90deg, rgba(0,231,216,0.35), transparent); border-radius: 0 8px 8px 0; }
.clip .kf-marks { position: absolute; left: 0; right: 0; bottom: 1px; height: 8px; pointer-events: none; }
.clip .kf-marks i {
  position: absolute; width: 5px; height: 5px; transform: rotate(45deg) translateX(-50%);
  background: var(--cyan); border-radius: 1px; bottom: 1px;
  box-shadow: 0 0 5px rgba(0, 231, 216, 0.8);
}
.clip .fade-mark { position: absolute; top: 0; bottom: 0; pointer-events: none; opacity: 0.5; }
.clip .fade-mark.in { left: 0; background: linear-gradient(90deg, rgba(0,0,0,0.75), transparent); }
.clip .fade-mark.out { right: 0; background: linear-gradient(-90deg, rgba(0,0,0,0.75), transparent); }
.clip .trans-badge {
  position: absolute; right: -1px; top: 50%; transform: translate(50%, -50%);
  width: 18px; height: 18px; border-radius: 50%; z-index: 4;
  background: var(--grad); color: #04252b; display: grid; place-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.6);
  pointer-events: none;
}
.clip .trans-badge svg { width: 10px; height: 10px; stroke-width: 2.6; }

.tl-playhead {
  position: absolute; top: 0; bottom: 0; width: 0; z-index: 6; pointer-events: none;
  border-left: 1.5px solid var(--coral);
  filter: drop-shadow(0 0 4px rgba(255, 59, 102, 0.7));
}
.ph-cap {
  position: sticky; top: 0;
  width: 11px; height: 13px; margin-left: -6.25px;
  background: var(--coral);
  clip-path: polygon(0 0, 100% 0, 100% 55%, 50% 100%, 0 55%);
}

.ghost-clip {
  position: absolute; top: 5px; bottom: 5px; border-radius: 9px; z-index: 5;
  background: rgba(0, 231, 216, 0.18); border: 1.5px dashed var(--cyan);
  pointer-events: none;
}
.snap-line { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed var(--amber); z-index: 5; pointer-events: none; }

.tl-resizer { position: absolute; left: 0; right: 0; top: -4px; height: 8px; cursor: ns-resize; z-index: 10; }

/* ==================== MODALS ==================== */
.modal-back {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(4, 6, 10, 0.72); backdrop-filter: blur(6px);
  display: grid; place-items: center;
  animation: fadeIn 0.15s;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  width: min(480px, calc(100vw - 32px)); max-height: min(640px, calc(100vh - 48px));
  background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 18px;
  box-shadow: var(--shadow); overflow-y: auto;
  animation: pop 0.18s cubic-bezier(0.2, 1.4, 0.4, 1);
  padding-bottom: 16px;
}
@keyframes pop { from { transform: scale(0.94) translateY(8px); opacity: 0; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px 10px;
}
.modal-head h3 { font-size: 16px; }

.proj-new-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 4px 18px 12px; }
.proj-new {
  padding: 13px 6px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; transition: 0.15s;
  display: flex; flex-direction: column; gap: 2px; align-items: center;
}
.proj-new b { font-size: 15px; color: var(--cyan); }
.proj-new span { font-size: 10.5px; color: var(--muted); }
.proj-new:hover { border-color: rgba(0, 231, 216, 0.5); transform: translateY(-1px); background: var(--surface-2); }
.proj-list { display: flex; flex-direction: column; gap: 6px; padding: 0 18px; }
.proj-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border: 1px solid var(--border); border-radius: 11px; cursor: pointer;
  background: var(--surface); transition: 0.14s;
}
.proj-item:hover { border-color: rgba(0, 231, 216, 0.45); background: var(--surface-2); }
.proj-item .pi-meta { flex: 1; min-width: 0; }
.proj-item .pi-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-item .pi-sub { font-size: 10.5px; color: var(--muted); }
.proj-item .tbtn { opacity: 0; }
.proj-item:hover .tbtn { opacity: 1; }
.proj-empty { color: var(--muted-2); text-align: center; font-size: 12px; padding: 18px 0 8px; }

.exp-body { padding: 4px 18px 0; display: flex; flex-direction: column; gap: 12px; }
.exp-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.exp-progress { padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.exp-ring { position: relative; width: 120px; height: 120px; }
.exp-ring svg { transform: rotate(-90deg); }
.ring-bg, .ring-fg { fill: none; stroke-width: 8; }
.ring-bg { stroke: rgba(255,255,255,0.08); }
.ring-fg {
  stroke: url(#) var(--cyan); stroke: var(--cyan); stroke-linecap: round;
  stroke-dasharray: 326.7; stroke-dashoffset: 326.7;
  transition: stroke-dashoffset 0.4s;
  filter: drop-shadow(0 0 6px rgba(0, 231, 216, 0.6));
}
.ring-label {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: 'Space Grotesk'; font-size: 22px; font-weight: 700;
}
#expStage { color: var(--muted); font-size: 12.5px; }
.exp-done { padding: 6px 18px 0; display: flex; flex-direction: column; gap: 12px; }
.exp-done video { width: 100%; max-height: 320px; border-radius: 12px; background: #000; }
.exp-actions { display: flex; gap: 8px; }
.exp-actions .btn { flex: 1; }
.tt-form { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; border-top: 1px solid var(--border); }

/* ==================== РЕЗАК (trim modal) ==================== */
.trim-modal { width: min(560px, calc(100vw - 32px)); }
.trim-body { padding: 0 18px; display: flex; flex-direction: column; gap: 12px; }
.trim-player {
  position: relative; display: grid; place-items: center;
  background: #000; border-radius: 12px; overflow: hidden;
  max-height: 46vh; min-height: 220px;
}
.trim-player video { max-width: 100%; max-height: 46vh; display: block; }
.trim-cur {
  position: absolute; right: 8px; top: 8px;
  background: rgba(0, 0, 0, 0.72); border-radius: 7px; padding: 3px 8px;
  font-family: 'Space Grotesk'; font-size: 12px; font-weight: 600; color: var(--cyan);
  font-variant-numeric: tabular-nums; pointer-events: none;
}
.trim-range {
  position: relative; height: 62px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--border); background: #0a0e16;
  cursor: pointer; user-select: none; touch-action: none;
}
.trim-strip { position: absolute; inset: 0; width: 100%; height: 100%; }
.trim-shade { position: absolute; top: 0; bottom: 0; background: rgba(4, 6, 10, 0.75); pointer-events: none; }
.trim-shade.l { left: 0; }
.trim-shade.r { right: 0; }
.trim-sel {
  position: absolute; top: 0; bottom: 0; pointer-events: none;
  border: 2px solid var(--cyan); border-left-width: 0; border-right-width: 0;
  box-shadow: inset 0 0 22px rgba(0, 231, 216, 0.12);
}
.trim-handle {
  position: absolute; top: 0; bottom: 0; width: 16px; cursor: ew-resize; z-index: 3;
  background: var(--cyan); display: grid; place-items: center;
}
.trim-handle.l { border-radius: 10px 0 0 10px; margin-left: -1px; }
.trim-handle.r { border-radius: 0 10px 10px 0; margin-right: -1px; }
.trim-handle i { width: 3px; height: 46%; border-radius: 2px; background: rgba(3, 39, 44, 0.75); }
.trim-handle:hover { filter: brightness(1.15); }
.trim-cursor {
  position: absolute; top: 0; bottom: 0; width: 0; z-index: 2;
  border-left: 2px solid var(--coral); pointer-events: none;
  filter: drop-shadow(0 0 4px rgba(255, 59, 102, 0.8));
}
.trim-info { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.trim-label {
  font-family: 'Space Grotesk'; font-size: 13px; font-weight: 600; color: var(--cyan);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.trim-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.trim-actions .btn { flex: 1; padding: 8px 6px; font-size: 12px; white-space: nowrap; }
.trim-modal .tt-form { border-top: 1px dashed var(--border); padding-top: 12px; }

/* кнопка ✂️ на медиа-карточке */
.media-item .mi-cut {
  position: absolute; right: 5px; top: 31px; width: 22px; height: 22px;
  border-radius: 6px; border: none; cursor: pointer;
  background: rgba(0, 0, 0, 0.65); color: #fff; font-size: 11px;
  display: grid; place-items: center; opacity: 0; transition: 0.15s;
}
.media-item:hover .mi-cut { opacity: 1; }
.media-item .mi-cut:hover { background: rgba(0, 231, 216, 0.85); color: #03272c; }

/* ==================== TOASTS ==================== */
.toasts { position: fixed; right: 16px; top: 60px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 9px;
  background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 12px;
  padding: 10px 14px; font-size: 12.5px; font-weight: 500;
  box-shadow: var(--shadow); max-width: 340px;
  animation: slideIn 0.22s cubic-bezier(0.2, 1.2, 0.4, 1);
}
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } }
.toast.out { transition: 0.25s; opacity: 0; transform: translateX(24px); }
.toast .ti { width: 16px; height: 16px; flex: none; }
.toast.ok .ti { color: var(--emerald); }
.toast.err .ti { color: var(--red); }
.toast.info .ti { color: var(--cyan-2); }

.drag-ghost {
  position: fixed; z-index: 300; pointer-events: none;
  width: 86px; height: 58px; border-radius: 9px;
  background-size: cover; background-position: center;
  border: 1.5px solid var(--cyan); box-shadow: 0 10px 30px -8px rgba(0, 231, 216, 0.5);
  opacity: 0.9; transform: translate(-50%, -60%) rotate(2deg);
  display: grid; place-items: center; font-size: 22px;
}

/* ==================== МЕМЫ ==================== */
.meme-subnav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 5px;
  padding: 4px; margin-bottom: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 11px;
}
.meme-subnav button {
  padding: 7px 4px; border: none; border-radius: 8px; background: transparent;
  color: var(--muted); font-weight: 700; font-size: 12px; cursor: pointer; transition: 0.15s;
}
.meme-subnav button.active { background: rgba(0, 231, 216, 0.14); color: var(--cyan); }
.meme-subnav button:hover { color: var(--text); }

.meme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.meme-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 13px 8px 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; transition: 0.16s; text-align: center;
}
.meme-card:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 231, 216, 0.55);
  background: linear-gradient(160deg, rgba(0, 231, 216, 0.08), rgba(255, 59, 102, 0.05)), var(--surface-2);
  box-shadow: 0 10px 26px -10px rgba(0, 231, 216, 0.35);
}
.meme-emoji { font-size: 27px; line-height: 1; filter: drop-shadow(0 3px 8px rgba(0,0,0,0.4)); }
.meme-card b { font-size: 12px; color: var(--text); }
.meme-desc { font-size: 9.5px; color: var(--muted-2); line-height: 1.3; }
.meme-hint { font-size: 10.5px; color: var(--muted-2); margin-top: 10px; text-align: center; line-height: 1.4; }

.snd-cats { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 9px; }
.snd-cat {
  padding: 4px 10px; border-radius: 20px; font-size: 10.5px; font-weight: 700;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  cursor: pointer; transition: 0.14s;
}
.snd-cat:hover { color: var(--text); }
.snd-cat.active { color: var(--cc, var(--cyan)); border-color: var(--cc, var(--cyan)); background: color-mix(in srgb, var(--cc, var(--cyan)) 12%, transparent); }
.snd-install { margin-bottom: 9px; font-size: 11px; color: var(--muted); }
.snd-list { display: flex; flex-direction: column; gap: 5px; }
.snd-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); transition: 0.13s;
}
.snd-row:hover { border-color: var(--border-2); background: var(--surface-2); }
.snd-play {
  width: 28px; height: 28px; flex: none; border-radius: 50%;
  border: none; background: rgba(0, 231, 216, 0.14); color: var(--cyan);
  cursor: pointer; font-size: 11px; transition: 0.15s;
}
.snd-play:hover { background: rgba(0, 231, 216, 0.3); }
.snd-play.on { background: var(--grad); color: #03272c; box-shadow: 0 0 12px rgba(0,231,216,0.5); }
.snd-meta { flex: 1; min-width: 0; }
.snd-meta b { display: block; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.snd-meta span { display: block; font-size: 9.5px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.snd-cat-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cc, #8b95a7); flex: none; box-shadow: 0 0 6px var(--cc, transparent); }
.snd-dur { font-size: 9.5px; color: var(--muted-2); flex: none; min-width: 26px; text-align: right; }
.snd-add, .snd-del {
  width: 24px; height: 24px; flex: none; border-radius: 7px; border: none;
  background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; transition: 0.13s;
}
.snd-add:hover { background: rgba(0, 231, 216, 0.18); color: var(--cyan); }
.snd-del { font-size: 10px; opacity: 0; }
.snd-row:hover .snd-del { opacity: 1; }
.snd-del:hover { background: rgba(255, 84, 112, 0.15); color: var(--red); }
.snd-foot { display: flex; gap: 6px; margin-top: 10px; }
.snd-add-form { display: flex; flex-direction: column; gap: 7px; margin-top: 8px; padding: 10px; border: 1px dashed var(--border-2); border-radius: var(--radius-sm); }
.progress { height: 6px; border-radius: 4px; background: rgba(255,255,255,0.08); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--grad); border-radius: 4px; transition: width 0.4s; }

.clip.type-frame { background: linear-gradient(135deg, rgba(157, 123, 255, 0.25), rgba(24, 182, 255, 0.15)); }

/* narrow screens: stack panels */
@media (max-width: 1100px) {
  .ed-mid { grid-template-columns: 240px 1fr 250px; }
}
@media (max-width: 880px) {
  .ed-mid { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  .ed-left, .ed-right { max-height: 200px; }
}

/* ═══════════════════════ ПРЕМИУМ-МОДАЛКИ (студия) ═══════════════════════ */
.modal-back {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(130% 100% at 50% -10%, rgba(0,231,216,.07), transparent 55%),
    rgba(3,5,9,.74);
  backdrop-filter: blur(12px) saturate(1.15);
  -webkit-backdrop-filter: blur(12px) saturate(1.15);
  animation: mbFade .2s ease;
}
@keyframes mbFade { from { opacity: 0; } }
.modal {
  position: relative;
  width: min(480px, 100%); max-height: min(90vh, 900px);
  background: linear-gradient(180deg, rgba(22,29,45,.97), rgba(11,15,24,.98));
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 22px;
  box-shadow:
    0 44px 130px -34px rgba(0,0,0,.88),
    0 0 0 1px rgba(0,231,216,.05),
    inset 0 1px 0 rgba(255,255,255,.06);
  overflow: hidden auto;
  animation: mPop .38s cubic-bezier(.16,1,.3,1);
  padding-bottom: 18px;
}
.modal::before {
  content: ''; position: absolute; left: 20px; right: 20px; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--cyan-2), transparent);
  opacity: .85; z-index: 1;
}
@keyframes mPop { from { opacity: 0; transform: translateY(18px) scale(.965); } }
.modal-head {
  display: flex; align-items: center; gap: 11px;
  padding: 17px 18px 12px;
}
.modal-head::before {
  content: ''; width: 4px; align-self: stretch; min-height: 22px; flex: none;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--cyan), var(--cyan-2));
  box-shadow: 0 0 14px rgba(0,231,216,.55);
}
.modal-head h3 { flex: 1; font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.modal-head .tbtn {
  width: 32px; height: 32px; border-radius: 9px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.09); color: var(--muted);
  transition: transform .2s cubic-bezier(.2,1.4,.4,1), background .16s, color .16s, border-color .16s;
}
.modal-head .tbtn:hover {
  background: rgba(255,84,112,.15); border-color: rgba(255,84,112,.42);
  color: var(--red); transform: rotate(90deg);
}
.modal::-webkit-scrollbar { width: 10px; }
.modal::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
.modal::-webkit-scrollbar-thumb:hover { background: rgba(0,231,216,.35); background-clip: content-box; }

@media (max-width: 560px) {
  .modal-back { padding: 0; align-items: end; grid-template-rows: 1fr auto; }
  .modal, .trim-modal {
    width: 100%; max-height: 94vh; border-radius: 22px 22px 0 0;
    animation: mSheet .32s cubic-bezier(.16,1,.3,1);
  }
  .modal::before { left: 18px; right: 18px; }
  @keyframes mSheet { from { transform: translateY(100%); } }
  .trim-actions .btn { flex: 1 1 46%; }
}
/* резак шире базовой модалки */
.modal.trim-modal { width: min(600px, calc(100vw - 40px)); }

/* --- озвучка / серверные титры / карточки --- */
.f-check { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); cursor: pointer; margin: 8px 0; }
.f-check input { accent-color: var(--cyan); width: 15px; height: 15px; }
.insp-hint { font-size: 10.5px; color: var(--muted); line-height: 1.45; margin: 4px 0 6px 18px; }
.tts-status { font-size: 11.5px; color: var(--muted); margin-top: 8px; min-height: 16px; }
#pane-tts.active { display: flex; flex-direction: column; gap: 10px; padding: 12px; overflow-y: auto; }
#pane-tts textarea { resize: vertical; min-height: 90px; }
.cap-group-card { border: 1px solid rgba(255,255,255,.08); border-radius: 10px; padding: 8px; margin-top: 8px; background: rgba(255,255,255,.03); }
.cap-group-card textarea { margin-top: 6px; font-size: 11.5px; }
.cap-lane { height: 26px; position: relative; border-top: 1px dashed rgba(255,226,58,.25); background: rgba(255,226,58,.03); }
.cap-lane-head { opacity: .85; height: 26px; min-height: 26px; }
.cap-lane-head .th-name { font-size: 10.5px; }
.cap-lane-chip { position: absolute; top: 3px; height: 20px; border-radius: 6px; background: rgba(255,226,58,.14); border: 1px solid rgba(255,226,58,.4); color: #ffe23a; font-size: 9.5px; line-height: 18px; padding: 0 7px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: grab; user-select: none; }
.cap-lane-chip:hover { background: rgba(255,226,58,.24); }
.cap-lane-chip.selected { border-color: #ffe23a; box-shadow: 0 0 0 1px #ffe23a; background: rgba(255,226,58,.3); }
.vo-text { margin-top: 6px; }
.vo-redo { margin-top: 6px; }

/* --- панель кейфреймов в инспекторе --- */
.kf-panel { margin-top: 10px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 10px; background: rgba(0,231,216,.05); display: flex; flex-direction: column; gap: 8px; }
.kf-nav { display: flex; align-items: center; gap: 8px; }
.kf-nav .kf-count { flex: 1; text-align: center; font-size: 11.5px; color: var(--muted); }
.btn.tiny { padding: 3px 10px; font-size: 12px; min-width: 30px; }
.kf-ease { display: flex; align-items: center; gap: 8px; }
.kf-ease .plabel { flex: none; }
.kf-ease select { flex: 1; }

/* ==================== COMMAND PALETTE / SHORTCUTS ==================== */
kbd {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  color: var(--amber);
  background: rgba(255, 194, 75, 0.08);
  border: 1px solid rgba(255, 194, 75, 0.28);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 3px 6px;
  min-width: 20px;
  text-align: center;
  display: inline-block;
  font-variant-numeric: tabular-nums;
}
.kplus { color: var(--muted-2); font-size: 10px; margin: 0 3px; vertical-align: middle; }

.cmdk-btn { padding-right: 8px; gap: 7px; }
.cmdk-btn .cmdk-cap {
  color: var(--muted); background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-2); border-bottom-width: 2px;
}

.cmdk-back, .sc-back {
  position: fixed; inset: 0; z-index: 200;
  display: flex; justify-content: center;
  background: rgba(4, 7, 12, 0.62);
  backdrop-filter: blur(7px);
  animation: fadeIn 0.14s ease;
}
.cmdk-back { align-items: flex-start; padding-top: 12vh; }
.sc-back { align-items: center; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.cmdk {
  width: min(620px, 92vw);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 0 0 1px rgba(0, 231, 216, 0.12), 0 24px 70px -20px rgba(0, 231, 216, 0.22);
  overflow: hidden;
  animation: cmdkPop 0.16s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes cmdkPop { from { transform: translateY(-10px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }

.cmdk-search {
  display: flex; align-items: center; gap: 11px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--border);
}
.cmdk-search svg { width: 18px; height: 18px; color: var(--cyan); flex: none; }
.cmdk-search input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-size: 15px; letter-spacing: 0.1px;
}
.cmdk-search input::placeholder { color: var(--muted-2); }
.cmdk-hint {
  color: var(--muted); background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-2); border-bottom-width: 2px; text-transform: uppercase;
}

.cmdk-list { max-height: 46vh; overflow-y: auto; padding: 7px; }
.cmdk-item {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border: none; border-radius: var(--radius-sm);
  background: none; color: var(--text); cursor: pointer; text-align: left;
  transition: background 0.08s;
}
.cmdk-item.active { background: rgba(0, 231, 216, 0.11); box-shadow: inset 0 0 0 1px rgba(0, 231, 216, 0.22); }
.cmdk-label { font-size: 13.5px; }
.cmdk-keys { display: flex; align-items: center; gap: 0; flex: none; }
.cmdk-empty { padding: 26px; text-align: center; color: var(--muted); font-size: 13px; }

.cmdk-foot {
  display: flex; gap: 18px; padding: 10px 16px;
  border-top: 1px solid var(--border); color: var(--muted); font-size: 11.5px;
}
.cmdk-foot span { display: inline-flex; align-items: center; gap: 5px; }
.cmdk-foot kbd { color: var(--muted); background: rgba(255, 255, 255, 0.05); border-color: var(--border-2); padding: 2px 5px; }

.sc-sheet {
  width: min(560px, 92vw); max-height: 82vh; overflow: hidden;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border-2); border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  animation: cmdkPop 0.16s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.sc-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px; border-bottom: 1px solid var(--border);
}
.sc-head b { font-size: 15px; letter-spacing: 0.2px; }
.sc-x { width: 30px; height: 30px; padding: 7px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; }
.sc-x:hover { color: var(--text); border-color: var(--border-2); }
.sc-grid { overflow-y: auto; padding: 8px 10px 14px; column-count: 2; column-gap: 10px; }
.sc-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; break-inside: avoid;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
}
.sc-row span:first-child { font-size: 12.5px; color: var(--text); }

@media (max-width: 720px) { .sc-grid { column-count: 1; } }
@media (prefers-reduced-motion: reduce) {
  .cmdk-back, .sc-back, .cmdk, .sc-sheet { animation: none; }
}

/* ==================== ПАНЕЛЬ ТРЕНДОВ (студия) ==================== */
.tr-ed-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tr-ed-load, .tr-ed-empty { grid-column: 1/-1; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 30px 8px; color: var(--muted); font-size: 12.5px; text-align: center; }
.tr-ed-load .tr-spin { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--border-2); border-top-color: var(--cyan); animation: tr-rot .8s linear infinite; }
@keyframes tr-rot { to { transform: rotate(360deg); } }
.tr-ed-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; display: flex; flex-direction: column; }
.tr-ed-thumb { position: relative; aspect-ratio: 9/16; background: #05070c; overflow: hidden; }
.tr-ed-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tr-ed-dur { position: absolute; bottom: 6px; right: 6px; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 10px; background: rgba(4,7,12,.72); color: var(--cyan); }
.tr-ed-name { font-size: 11.5px; line-height: 1.3; padding: 7px 8px 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tr-ed-add { margin: 4px 8px 8px; font-size: 11.5px; padding: 6px; }
.tr-ed-tag { padding: 12px; cursor: pointer; gap: 4px; transition: border-color .15s; }
.tr-ed-tag:hover { border-color: var(--cyan); }
.tr-ed-tag b { font-size: 14px; font-family: 'Space Grotesk', sans-serif; }
.tr-ed-tag small { color: var(--muted); font-size: 11px; }
