/* Родные CS — медиа профиля (сайт и приложение) */
.rcsm{--rm-bg:#0f172a;--rm-card:#111c30;--rm-line:#1e293b;--rm-text:#e2e8f0;--rm-muted:#94a3b8;--rm-acc:#38bdf8;--rm-acc2:#818cf8;--rm-on:#06111f;
  color:var(--rm-text);font:14px/1.45 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Inter,Arial,sans-serif}
.rcsm--app{--rm-bg:#12100c;--rm-card:#17140f;--rm-line:#2c261b;--rm-text:#f1ebdd;--rm-muted:#a39885;--rm-acc:#f5cf72;--rm-acc2:#d9a441;--rm-on:#1b1306}
.rcsm *{box-sizing:border-box}
.rcsm button{font:inherit;color:inherit;border:0;background:none;cursor:pointer;padding:0}
.rcsm svg{display:block}
.rcsm-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px}
.rcsm-head b{display:flex;align-items:center;gap:8px;font-size:17px}
.rcsm-head b svg{width:20px;height:20px;color:var(--rm-acc)}
.rcsm-count{color:var(--rm-muted);font-weight:500;font-size:14px}
.rcsm .rcsm-add{display:inline-flex;align-items:center;gap:7px;padding:9px 14px;border-radius:999px;font-weight:700;font-size:13.5px;color:var(--rm-on);
  background:linear-gradient(135deg,var(--rm-acc),var(--rm-acc2));box-shadow:0 8px 20px -10px var(--rm-acc)}
.rcsm-add svg{width:16px;height:16px}
.rcsm-empty{padding:28px 10px;text-align:center;color:var(--rm-muted)}
.rcsm-empty small{display:block;margin-top:6px;font-size:12px;opacity:.8}
.rcsm-progress{margin-bottom:12px;padding:10px 12px;border-radius:14px;background:var(--rm-card);border:1px solid var(--rm-line)}
.rcsm-progress[hidden]{display:none}
.rcsm-progress__text{font-size:12.5px;color:var(--rm-muted);margin-bottom:6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.rcsm-progress__bar{height:6px;border-radius:99px;background:var(--rm-line);overflow:hidden}
.rcsm-progress__bar i{display:block;height:100%;width:0;background:linear-gradient(90deg,var(--rm-acc),var(--rm-acc2));transition:width .2s}

/* треки */
.rcsm-track{display:flex;align-items:center;gap:10px;padding:9px 10px;border-radius:14px;background:var(--rm-card);border:1px solid var(--rm-line);margin-bottom:8px;transition:border-color .2s}
.rcsm-track.playing{border-color:var(--rm-acc);box-shadow:0 0 0 1px var(--rm-acc) inset}
.rcsm .rcsm-tplay{flex:0 0 auto;width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;color:var(--rm-on);
  background:linear-gradient(135deg,var(--rm-acc),var(--rm-acc2))}
.rcsm-tplay svg{width:18px;height:18px}
.rcsm-tmain{flex:1;min-width:0}
.rcsm-tmain b{display:block;font-size:14.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.rcsm-tmain small{display:block;font-size:12px;color:var(--rm-muted)}
.rcsm .rcsm-ibtn{flex:0 0 auto;width:34px;height:34px;border-radius:10px;display:flex;align-items:center;justify-content:center;color:var(--rm-muted)}
.rcsm .rcsm-ibtn:hover{color:var(--rm-text);background:rgba(255,255,255,.06)}
.rcsm-ibtn svg{width:18px;height:18px}

/* лайк */
.rcsm-like{flex:0 0 auto;display:inline-flex!important;align-items:center;gap:5px;padding:6px 10px!important;border-radius:999px!important;font-size:12.5px!important;
  background:rgba(255,255,255,.05)!important;border:1px solid var(--rm-line,#1e293b)!important;color:var(--rm-muted,#94a3b8)!important;cursor:pointer}
.rcsm-like svg{width:14px;height:14px}
.rcsm-like b{color:var(--rm-text,#e2e8f0);font-weight:700}
.rcsm-like.liked{background:rgba(244,63,94,.15)!important;border-color:#f43f5e!important;color:#fb7185!important}
.rcsm-like.pop svg{animation:rcsmPop .5s ease}
@keyframes rcsmPop{0%{transform:scale(1)}35%{transform:scale(1.5)}70%{transform:scale(.9)}100%{transform:scale(1)}}

/* видео */
.rcsm-vgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:12px}
.rcsm-vcard{border-radius:16px;overflow:hidden;background:var(--rm-card);border:1px solid var(--rm-line)}
.rcsm video{display:block;width:100%;max-height:70vh;background:#000;aspect-ratio:16/9;object-fit:contain}
.rcsm-vmeta{display:flex;align-items:center;gap:6px;padding:8px 10px}

/* фото */
.rcsm-pgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(110px,1fr));gap:6px}
.rcsm .rcsm-ph{position:relative;display:block;aspect-ratio:1;border-radius:12px;overflow:hidden;background:var(--rm-card)}
.rcsm-ph img{width:100%;height:100%;object-fit:cover;display:block}
.rcsm-phl{position:absolute;left:6px;bottom:6px;display:inline-flex;align-items:center;gap:3px;padding:2px 7px;border-radius:99px;background:rgba(0,0,0,.6);color:#fff;font-size:11px}
.rcsm-phl svg{width:11px;height:11px;color:#fb7185}
.rcsm-viewer{position:fixed;inset:0;z-index:2600;background:rgba(0,0,0,.94);display:flex;align-items:center;justify-content:center;flex-direction:column}
.rcsm-viewer img{max-width:100%;max-height:calc(100vh - 120px);object-fit:contain}
.rcsm-vx{position:absolute;top:calc(env(safe-area-inset-top,0px) + 10px);right:10px;width:44px;height:44px;border:0;border-radius:50%;background:rgba(255,255,255,.12);color:#fff;cursor:pointer}
.rcsm-vx svg{width:22px;height:22px;margin:auto}
.rcsm-vbar{--rm-line:#333;--rm-text:#fff;--rm-muted:#ccc;position:absolute;left:0;right:0;bottom:0;display:flex;align-items:center;gap:8px;padding:12px 14px calc(env(safe-area-inset-bottom,0px) + 14px);color:#fff;background:linear-gradient(0deg,rgba(0,0,0,.8),transparent)}
.rcsm-vt{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font:14px Arial,sans-serif}
.rcsm-vbar .rcsm-ibtn{width:38px;height:38px;border:0;border-radius:10px;background:rgba(255,255,255,.1);color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center}
.rcsm-vbar .rcsm-ibtn svg{width:19px;height:19px}

/* на стене */
.rcsm-inline{margin-top:8px;max-width:520px}
.rcsm-inline .rcsm-track{margin-bottom:0}
.rcsm-inline video{border-radius:14px}
.rcsm-inline .rcsm-vmeta{padding:6px 2px}
.rcsm-inline--photo{margin-top:6px}

/* нижний плеер */
.rcsm-player{position:fixed;left:50%;bottom:16px;z-index:2400;width:min(560px,calc(100% - 20px));transform:translate(-50%,140%);opacity:0;pointer-events:none;
  display:flex;align-items:center;gap:6px;padding:8px 10px;border-radius:18px;color:#e2e8f0;background:rgba(15,23,42,.96);border:1px solid #334155;
  box-shadow:0 18px 40px -14px #000;backdrop-filter:blur(10px);transition:transform .3s ease,opacity .3s ease;font:13px/1.3 -apple-system,"Segoe UI",Roboto,Arial,sans-serif}
.rcsm-player.show{transform:translate(-50%,0);opacity:1;pointer-events:auto}
.rcsm-player--app{bottom:calc(var(--tabbar,64px) + env(safe-area-inset-bottom,0px) + 8px);z-index:240;background:rgba(23,20,15,.97);border-color:#3a3122;color:#f1ebdd}
@media (max-width:991px){html:not(.rcs-app) .rcsm-player:not(.rcsm-player--app){bottom:76px}}
.rcsm-pbtn{flex:0 0 auto;width:36px;height:36px;border:0;border-radius:50%;background:none;color:inherit;cursor:pointer;display:flex;align-items:center;justify-content:center}
.rcsm-pbtn svg{width:18px;height:18px}
.rcsm-pbtn--main{width:42px;height:42px;color:#06111f;background:linear-gradient(135deg,#38bdf8,#818cf8)}
.rcsm-player--app .rcsm-pbtn--main{color:#1b1306;background:linear-gradient(135deg,#f5cf72,#d9a441)}
.rcsm-pinfo{flex:1;min-width:0;padding:0 4px}
.rcsm-ptitle{font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.rcsm-prow{display:flex;align-items:center;gap:8px}
.rcsm-prow input{flex:1;min-width:0;height:18px;accent-color:#38bdf8}
.rcsm-player--app .rcsm-prow input{accent-color:#f5cf72}
.rcsm-ptime{flex:0 0 auto;font-size:11px;opacity:.75;font-variant-numeric:tabular-nums}

.rcsm-toast{position:fixed;left:50%;bottom:150px;z-index:2700;transform:translateX(-50%);max-width:90%;padding:10px 16px;border-radius:12px;background:#111827;border:1px solid #334155;
  color:#f1f5f9;font:14px/1.4 Arial,sans-serif;box-shadow:0 10px 24px -10px #000;transition:opacity .4s}
.rcsm-toast.out{opacity:0}

/* вкладки профиля на сайте */
.rcsm-site{background:rgba(30,41,59,.6);border:1px solid rgba(51,65,85,.5);border-radius:28px;padding:22px;min-height:420px}
@media (max-width:640px){.rcsm-site{padding:14px;border-radius:20px}.rcsm-vgrid{grid-template-columns:1fr}}

/* окно «Опубликовать на стене» */
.rcsm-sheet{position:fixed;inset:0;z-index:2550;background:rgba(3,6,12,.72);display:flex;align-items:flex-end;justify-content:center}
.rcsm-sheet__box{width:100%;max-width:560px;max-height:86vh;overflow-y:auto;background:var(--rm-bg);border:1px solid var(--rm-line);border-bottom:0;border-radius:24px 24px 0 0;
  padding:16px 16px calc(env(safe-area-inset-bottom,0px) + 18px);animation:rcsmUp .25s ease-out}
@keyframes rcsmUp{from{transform:translateY(40px);opacity:0}to{transform:none;opacity:1}}
.rcsm-sheet__top{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}
.rcsm-sheet__top b{font-size:18px}
.rcsm-tabs{display:flex;gap:4px;padding:4px;border-radius:14px;background:var(--rm-card);border:1px solid var(--rm-line);margin-bottom:12px}
.rcsm .rcsm-tabs button{flex:1;height:36px;border-radius:10px;font-weight:700;font-size:13.5px;color:var(--rm-muted)}
.rcsm .rcsm-tabs button.on{color:var(--rm-on);background:linear-gradient(135deg,var(--rm-acc),var(--rm-acc2))}
.rcsm .rcsm-add--block{width:100%;justify-content:center;padding:12px;margin-bottom:10px;font-size:14.5px}
.rcsm-hint{font-size:12.5px;color:var(--rm-muted);margin:4px 2px 8px}
.rcsm .rcsm-pick{width:100%;text-align:left}
.rcsm-pick .rcsm-tplay svg{width:20px;height:20px}
.rcsm-sthumb{width:44px;height:44px;border-radius:10px;object-fit:cover;flex:0 0 auto}
.rcsm-pick__go{flex:0 0 auto;font-size:12px;font-weight:700;color:var(--rm-acc);padding:6px 10px;border-radius:999px;border:1px solid var(--rm-line)}
.rcsm-attach{display:inline-flex;align-items:center;gap:7px;margin-right:auto;padding:8px 14px;border-radius:16px;border:1px solid #334155;background:#0f172a;color:#93c5fd;
  font:600 13px/1.2 Inter,Arial,sans-serif;cursor:pointer}
.rcsm-attach:hover{background:#1e293b}
.rcsm-attach svg{width:16px;height:16px}

/* комментарии к записям на стене */
.rcsm-cbar{margin-top:8px}
.rcsm .rcsm-cbtn,.rcsm-cbtn{display:inline-flex;align-items:center;gap:6px;padding:6px 12px;border-radius:999px;background:rgba(255,255,255,.05);border:1px solid var(--rm-line,#1e293b);
  color:var(--rm-muted,#94a3b8);font-size:12.5px;cursor:pointer}
.rcsm-cbtn svg{width:15px;height:15px}
.rcsm-cbtn b{color:var(--rm-text,#e2e8f0);font-weight:700}
.rcsm-cbtn.on{border-color:var(--rm-acc,#38bdf8);color:var(--rm-acc,#38bdf8)}
.rcsm-thread{margin-top:10px;padding:10px;border-radius:16px;background:var(--rm-card);border:1px solid var(--rm-line)}
.rcsm-cmts{max-height:380px;overflow-y:auto}
.rcsm-cnone{font-size:13px;color:var(--rm-muted);padding:4px 2px 10px}
.rcsm-cmt{display:flex;gap:9px;padding:7px 0}
.rcsm-cmt+.rcsm-cmt{border-top:1px solid var(--rm-line)}
.rcsm .rcsm-cav{flex:0 0 auto;width:32px;height:32px;border-radius:50%;overflow:hidden;background:var(--rm-line);display:flex;align-items:center;justify-content:center;color:var(--rm-muted);font-weight:700;font-size:13px}
.rcsm-cav img{width:100%;height:100%;object-fit:cover}
.rcsm-cbody{flex:1;min-width:0}
.rcsm-chead{display:flex;align-items:center;gap:8px}
.rcsm .rcsm-cname{font-weight:700;font-size:13.5px;max-width:60%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.rcsm-chead small{font-size:11.5px;color:var(--rm-muted)}
.rcsm .rcsm-cdel{margin-left:auto;width:24px;height:24px;border-radius:8px;color:var(--rm-muted);display:flex;align-items:center;justify-content:center}
.rcsm-cdel svg{width:14px;height:14px}
.rcsm-ctext{font-size:14px;line-height:1.45;overflow-wrap:anywhere;margin-top:1px}
.rcsm-cform{display:flex;align-items:flex-end;gap:8px;margin-top:8px}
.rcsm-cform textarea{flex:1;min-height:40px;max-height:120px;resize:none;padding:9px 12px;border-radius:12px;border:1px solid var(--rm-line);background:var(--rm-bg);color:var(--rm-text);
  font:inherit;font-size:14.5px;outline:none}
.rcsm-cform textarea:focus{border-color:var(--rm-acc)}
.rcsm .rcsm-csend{flex:0 0 auto;width:40px;height:40px;border-radius:12px;display:flex;align-items:center;justify-content:center;color:var(--rm-on);background:linear-gradient(135deg,var(--rm-acc),var(--rm-acc2))}
.rcsm-csend svg{width:18px;height:18px}
.rcsm-csend:disabled{opacity:.5}
/* rcs-mcmt: комментарии к фото и видео, репост */
.rcsm-vmedia{flex:1;min-height:0;width:100%;display:flex;align-items:center;justify-content:center;padding:60px 0 76px}
.rcsm-vmedia img,.rcsm-vmedia video{max-width:100%;max-height:calc(100vh - 140px);object-fit:contain;display:block;border-radius:6px;background:#000}
.rcsm-vbar .rcsm-mc--l{width:auto;padding:0 12px;gap:6px;font:600 13px Arial,sans-serif;white-space:nowrap}
.rcsm-mc b{font-weight:700;font-size:12px}
.rcsm-mc b:empty{display:none}
.rcsm .rcsm-mc{width:auto;min-width:34px;padding:0 6px;gap:4px}
.rcsm .rcsm-mc.on{color:var(--rm-acc,#38bdf8)}
.rcsm-vcard > .rcsm-thread{margin:0 10px 10px}
.rcsm-viewer .rcsm-vcp{box-sizing:border-box;position:absolute;left:0;right:0;bottom:0;height:56vh;z-index:3;display:flex;flex-direction:column;background:var(--rm-bg,#0f172a);border-top:1px solid var(--rm-line,#1e293b);border-radius:20px 20px 0 0;padding:12px 14px calc(env(safe-area-inset-bottom,0px) + 10px);box-shadow:0 -12px 40px rgba(0,0,0,.5)}
.rcsm-viewer .rcsm-vcp[hidden]{display:none}
.rcsm-vcp__head{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px;color:var(--rm-text,#e2e8f0)}
.rcsm-vcp__head b{display:inline-flex;align-items:center;gap:8px;font:700 15px Arial,sans-serif}
.rcsm-vcp__head b svg{width:18px;height:18px;color:var(--rm-acc,#38bdf8)}
.rcsm-vcp__x{width:34px;height:34px;border:0;border-radius:50%;background:rgba(255,255,255,.08);color:var(--rm-text,#e2e8f0);cursor:pointer;display:flex;align-items:center;justify-content:center}
.rcsm-vcp__x svg{width:16px;height:16px}
.rcsm-vcp__body{flex:1;min-height:0;display:flex;flex-direction:column}
.rcsm-vcp__body .rcsm-cmts{flex:1;max-height:none;min-height:0;overflow-y:auto}
.rcsm-viewer--c .rcsm-vmedia{padding-bottom:calc(56vh + 70px)}
.rcsm-viewer--c .rcsm-vmedia img,.rcsm-viewer--c .rcsm-vmedia video{max-height:calc(44vh - 130px)}
.rcsm-viewer--c .rcsm-vbar{bottom:56vh}
@media (min-width:900px){
  .rcsm-viewer .rcsm-vcp{left:auto;top:0;width:380px;height:auto;border-radius:0;border-top:0;border-left:1px solid var(--rm-line,#1e293b)}
  .rcsm-viewer--c{padding-right:380px}
  .rcsm-viewer--c .rcsm-vmedia{padding-bottom:76px}
  .rcsm-viewer--c .rcsm-vmedia img,.rcsm-viewer--c .rcsm-vmedia video{max-height:calc(100vh - 140px)}
  .rcsm-viewer--c .rcsm-vbar{bottom:0;right:380px}
  .rcsm-viewer--c .rcsm-vx{right:392px}
}
@media (max-width:420px){.rcsm-vbar .rcsm-mc--l span{font-size:12px}.rcsm-vbar{gap:6px}}

/* rcs-wallmulti: несколько файлов в одной записи на стене */
.rcsm-pick.on{border-color:var(--rm-acc)!important;background:rgba(56,189,248,.08)}
.rcsm-pick__chk{flex:0 0 auto;width:30px;height:30px;border-radius:50%;border:1.5px solid var(--rm-line);display:flex;align-items:center;justify-content:center;color:var(--rm-muted)}
.rcsm-pick__chk svg{width:16px;height:16px}
.rcsm-pick.on .rcsm-pick__chk{background:var(--rm-acc);border-color:var(--rm-acc);color:#fff}
.rcsm-sheet__foot{position:sticky;bottom:calc(-18px - env(safe-area-inset-bottom,0px));margin:12px -16px calc(-18px - env(safe-area-inset-bottom,0px));padding:10px 16px calc(14px + env(safe-area-inset-bottom,0px));background:var(--rm-bg);border-top:1px solid var(--rm-line);box-shadow:0 -10px 24px rgba(0,0,0,.35);display:flex;flex-direction:column;gap:8px;z-index:2}
.rcsm-sheet__foot[hidden]{display:none}
.rcsm-selrow{display:flex;gap:6px;overflow-x:auto;padding-bottom:2px;scrollbar-width:thin}
.rcsm-selchip{flex:0 0 auto;display:inline-flex;align-items:center;gap:6px;max-width:170px;padding:4px 4px 4px 4px;border-radius:999px;background:var(--rm-card);border:1px solid var(--rm-line);font-size:12.5px}
.rcsm-selchip img{width:24px;height:24px;border-radius:50%;object-fit:cover}
.rcsm-selchip>span{width:24px;height:24px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:var(--rm-line)}
.rcsm-selchip>span svg{width:14px;height:14px}
.rcsm-selchip em{font-style:normal;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.rcsm-selchip button{flex:0 0 auto;width:20px;height:20px;border:0;border-radius:50%;background:none;color:var(--rm-muted);padding:0;display:flex;align-items:center;justify-content:center;cursor:pointer}
.rcsm-selchip button svg{width:12px;height:12px}
.rcsm-cap{width:100%;min-height:40px;max-height:110px;resize:none;padding:9px 12px;border-radius:12px;border:1px solid var(--rm-line);background:var(--rm-card);color:var(--rm-text);font:14px Arial,sans-serif;box-sizing:border-box}
.rcsm .rcsm-post{width:100%;border:0;border-radius:12px;padding:11px;font-weight:700;font-size:15px;background:linear-gradient(135deg,#38bdf8,#818cf8);color:#fff;cursor:pointer;box-shadow:0 6px 18px rgba(56,189,248,.25)}
.rcsm .rcsm-post:disabled{opacity:.6;cursor:wait}
/* на стене: несколько фото в одной записи — аккуратной сеткой */
#comments .with_code:has(img[src*="/files/media/photo/"] ~ img[src*="/files/media/photo/"]) img[src*="/files/media/photo/"],
#comments .message:has(img[src*="/files/media/photo/"] ~ img[src*="/files/media/photo/"]) img[src*="/files/media/photo/"]{display:inline-block;width:calc(33.333% - 6px);max-width:220px;aspect-ratio:1/1;height:auto;object-fit:cover;margin:6px 6px 0 0;border-radius:10px;vertical-align:top}
#comments .with_code:has(img[src*="/files/media/photo/"] ~ img[src*="/files/media/photo/"]) .rcsm-inline--photo,
#comments .message:has(img[src*="/files/media/photo/"] ~ img[src*="/files/media/photo/"]) .rcsm-inline--photo{display:none}
