/* Полноэкранная вертикальная лента клипов в стиле TikTok. */
.shorts-section {
  gap: 14px;
}

.shorts-section .compact-section-head {
  align-items: end;
}

.short-video-feed {
  display: grid;
  grid-auto-rows: minmax(0, 76svh);
  gap: 14px;
  width: min(100%, 520px);
  max-height: 76svh;
  margin: 0 auto;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  scroll-behavior: smooth;
}

.short-video-feed::-webkit-scrollbar {
  display: none;
}

.short-video-card {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 24px;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.short-video-stage {
  height: 100%;
  aspect-ratio: auto;
  border-radius: inherit;
  isolation: isolate;
  background: #15131d;
}

.short-video-player {
  height: 100%;
  object-fit: cover;
  background: #15131d;
}

.short-video-player[data-active="true"] {
  will-change: transform;
}

.short-video-stage::after {
  position: absolute;
  inset: 45% 0 0;
  z-index: 1;
  background: linear-gradient(transparent, rgba(0, 0, 0, .68));
  content: '';
  pointer-events: none;
}

.short-video-overlay,
.short-video-tools {
  z-index: 2;
}

.short-video-overlay {
  bottom: 76px;
}

.short-video-tools button {
  min-height: 42px;
}

@media (max-width: 800px) {
  .shorts-section {
    margin-inline: -12px;
  }

  .shorts-section .compact-section-head {
    padding-inline: 12px;
  }

  .short-video-feed {
    width: 100vw;
    height: calc(100svh - 154px);
    max-height: none;
    grid-auto-rows: 100%;
    gap: 0;
    margin-inline: 0;
    border-radius: 0;
  }

  .short-video-card,
  .short-video-stage {
    border-radius: 0;
  }

  .short-video-overlay {
    right: 16px;
    bottom: 94px;
    left: 16px;
  }

  .short-video-tools {
    right: 12px;
    bottom: 18px;
    left: 12px;
  }
}

@media (max-width: 420px) {
  .short-video-feed {
    height: calc(100svh - 142px);
  }
}

@media (min-width: 801px) and (max-width: 1100px) {
  .short-video-feed {
    grid-auto-rows: min(78svh, 760px);
    max-height: min(78svh, 760px);
  }
}

@media (min-width: 1101px) {
  .short-video-feed {
    grid-auto-rows: min(80svh, 780px);
    max-height: min(80svh, 780px);
  }
}

/* Вертикальная панель действий клипа справа. */
.short-video-tools {
  right: 14px;
  bottom: 104px;
  left: auto;
  width: 64px;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  pointer-events: none;
}

.short-video-tools button,
.short-video-tools > span {
  display: flex;
  width: 58px;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  border: 0;
  border-radius: 0;
  color: #fff;
  background: transparent;
  font-size: 11px;
  line-height: 1.15;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .8);
  white-space: normal;
}

.short-video-tools button {
  pointer-events: auto;
  flex-direction: column;
  gap: 4px;
}

.short-video-tools .ui-icon {
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
}

.short-video-tools .short-action-count,
.short-video-tools .short-action-label {
  display: block;
  max-width: 100%;
  overflow: hidden;
  font-size: 10px;
  line-height: 1.1;
  text-overflow: ellipsis;
}

.short-video-tools .short-video-views {
  flex-direction: column;
  gap: 4px;
}

.short-video-tools .short-video-like.liked,
.short-video-tools .short-video-like.liked .ui-icon {
  color: #ff5d8f;
}

.short-video-tools .short-video-repost.reposted,
.short-video-tools .short-video-repost.reposted .ui-icon {
  color: #bda2ff;
}

.short-video-tools button:hover,
.short-video-tools button:focus-visible {
  border-color: rgba(255, 255, 255, .55);
  background: rgba(120, 76, 190, .88);
  outline: none;
}

.short-video-tools .short-video-like,
.short-video-tools .short-video-repost,
.short-video-tools .short-video-share {
  margin: 0;
}

.short-video-tools .short-video-delete {
  min-height: 38px;
  color: #ffc2d0;
  font-size: 10px;
}

.short-video-overlay {
  right: 88px;
}

.short-video-author-link{display:inline-flex;align-items:baseline;gap:6px;padding:0;color:#fff;background:transparent;font:inherit;font-weight:700;text-align:left;text-shadow:0 2px 8px rgba(0,0,0,.8)}.short-video-author-link small{color:rgba(255,255,255,.72);font-size:11px;font-weight:500}.short-video-author-link:hover,.short-video-author-link:focus-visible{color:#e6d6ff;text-decoration:underline;outline:none}

@media (max-width: 800px) {
  .short-video-tools {
    right: 12px;
    bottom: 96px;
    left: auto;
  }

  .short-video-overlay {
    right: 88px;
  }
}

/* Локальное меню безопасности клипа: не вызывает перерисовку и не прерывает видео. */
.short-comments-sheet[hidden]{display:none!important}
/* The menu has a display:grid rule, so enforce the native closed state. */
.short-clip-menu[hidden], .short-clip-submenu[hidden] { display: none !important; }
.short-clip-safety { position: absolute; z-index: 8; top: 14px; right: 14px; }
.short-clip-more { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid rgba(255,255,255,.28); border-radius: 50%; color: #fff; background: rgba(10,8,14,.4); font-size: 18px; font-weight: 800; letter-spacing: 2px; text-shadow: 0 2px 8px rgba(0,0,0,.8); backdrop-filter: blur(10px); }
.short-clip-more:hover, .short-clip-more:focus-visible { background: rgba(120,76,190,.88); outline: none; }
.short-clip-menu { position: absolute; top: 48px; right: 0; display: grid; min-width: 190px; padding: 6px; border: 1px solid rgba(255,255,255,.2); border-radius: 14px; background: rgba(16,12,24,.98); box-shadow: 0 14px 34px rgba(0,0,0,.42); }
.short-clip-menu button { min-height: 42px; padding: 9px 12px; border: 0; border-radius: 10px; color: #fff; background: transparent; font-size: 13px; text-align: left; }
.short-clip-menu button:hover, .short-clip-menu button:focus-visible { background: rgba(255,255,255,.1); outline: none; }
.short-clip-menu button + button { color: #ffc2d0; }

/* Нижняя панель комментариев клипа — открывается поверх текущего видео. */
.short-video-comments { cursor: pointer; }
.short-comments-sheet {
  position: absolute;
  z-index: 5;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(100%, 430px);
  height: min(58%, 430px);
  margin: 0 auto;
  padding: 14px 14px max(14px, env(safe-area-inset-bottom));
  border: 1px solid rgba(255, 255, 255, .2);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  color: #fff;
  background: rgba(16, 12, 24, .97);
  box-shadow: 0 -20px 50px rgba(0, 0, 0, .42);
  backdrop-filter: blur(18px);
}
.short-comments-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 10px; border-bottom: 1px solid rgba(255, 255, 255, .12); }
.short-comments-close, .short-comment-delete { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid rgba(255, 255, 255, .2); border-radius: 50%; color: #fff; background: rgba(255, 255, 255, .1); }
.short-comments-list { min-height: 0; padding: 10px 2px; overflow-y: auto; }
.short-comment-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) 36px; gap: 9px; align-items: start; padding: 9px 0; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.short-comment-row strong, .short-comment-row p, .short-comment-row small { display: block; margin: 0; }
.short-comment-row p { margin-top: 3px; color: rgba(255, 255, 255, .9); font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.short-comment-row small, .short-comments-empty { color: rgba(255, 255, 255, .56); font-size: 11px; }
.short-comment-form { display: flex; gap: 8px; padding-top: 10px; }
.short-comment-form input { min-width: 0; flex: 1; min-height: 44px; padding: 0 12px; border: 1px solid rgba(255, 255, 255, .18); border-radius: 14px; color: #fff; background: rgba(255, 255, 255, .08); }
.short-comment-form .primary-btn { min-height: 44px; padding-inline: 13px; }
@media (max-width: 800px) { .short-comments-sheet { width: 100%; height: min(62%, 480px); border-radius: 24px 24px 0 0; } }

/* Список друзей, которые сделали репост клипа. */
.short-video-tools .short-video-repost-people {
  min-height: 50px;
  cursor: pointer;
}
.short-video-repost-people > span:first-child {
  color: #d8c7ff;
  font-size: 15px;
  letter-spacing: -4px;
}
.short-repost-sheet {
  position: absolute;
  z-index: 6;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(100%, 430px);
  max-height: min(64%, 470px);
  margin: 0 auto;
  padding: 14px 14px max(14px, env(safe-area-inset-bottom));
  border: 1px solid rgba(255, 255, 255, .2);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  color: #fff;
  background: rgba(16, 12, 24, .98);
  box-shadow: 0 -20px 50px rgba(0, 0, 0, .45);
  backdrop-filter: blur(18px);
}
.short-repost-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid rgba(255, 255, 255, .12); }
.short-repost-head strong, .short-repost-head small { display: block; }
.short-repost-head small { margin-top: 3px; color: rgba(255, 255, 255, .58); font-size: 11px; }
.short-repost-close { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid rgba(255, 255, 255, .2); border-radius: 50%; color: #fff; background: rgba(255, 255, 255, .1); }
.short-repost-list { min-height: 0; padding: 8px 0; overflow-y: auto; }
.short-repost-person { display: grid; grid-template-columns: 34px minmax(0, 1fr) 24px; gap: 10px; align-items: center; width: 100%; min-height: 52px; padding: 7px 4px; border-bottom: 1px solid rgba(255, 255, 255, .08); color: #fff; background: transparent; text-align: left; }
.short-repost-person:hover, .short-repost-person:focus-visible { background: rgba(255, 255, 255, .08); outline: none; }
.short-repost-person strong, .short-repost-person small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.short-repost-person small { margin-top: 2px; color: rgba(255, 255, 255, .58); font-size: 11px; }
.short-repost-person b { color: rgba(255, 255, 255, .55); font-size: 20px; font-weight: 400; text-align: right; }
.short-repost-empty { display: grid; gap: 6px; padding: 22px 6px; color: rgba(255, 255, 255, .68); text-align: center; }
.short-repost-empty strong { color: #fff; }
.short-repost-empty span { font-size: 13px; line-height: 1.4; }
@media (max-width: 800px) { .short-repost-sheet { width: 100%; max-height: min(68%, 520px); border-radius: 24px 24px 0 0; } }

/* Mobile clips: one clean full-height stage and a small TikTok-style create button. */
.shorts-create-fab {
  display: grid !important;
  position: fixed;
  z-index: 24;
  right: 16px;
  bottom: calc(86px + env(safe-area-inset-bottom));
  place-items: center;
  width: 48px;
  height: 48px;
  min-height: 48px;
  padding: 0 !important;
  border: 1px solid var(--line) !important;
  border-radius: 50% !important;
  color: #fff !important;
  background: var(--purple-2) !important;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .36);
  font-size: 28px;
  line-height: 1;
}
.shorts-create-drawer[open] > .shorts-create-fab { color: #fff !important; background: var(--purple) !important; }
.short-recorder-panel { display: grid; gap: 10px; margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel-2); }
.short-recorder-head, .short-recorder-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.short-recorder-panel video { width: 100%; max-height: 280px; border-radius: 12px; background: var(--bg); object-fit: cover; }
.short-recorder-panel small { color: var(--muted); line-height: 1.35; }
.short-record-trigger { border-color: var(--purple) !important; }

@media (max-width: 800px) {
  .videos-view { margin-inline: -12px; }
  .videos-view .videos-heading,
  .videos-view > .video-search,
  .videos-view > .video-channels,
  .videos-view > .video-grid { display: none; }
  .videos-view .shorts-section { margin: 0; gap: 0; }
  .videos-view .shorts-section .compact-section-head { display: none; }
  .videos-view .short-video-feed { height: calc(100dvh - 136px); max-height: none; }
  .videos-view .short-video-card,
  .videos-view .short-video-stage { min-height: calc(100dvh - 136px); }
  .videos-view .short-video-overlay { bottom: 92px; }
  .videos-view .short-video-tools { bottom: 94px; }
  .shorts-create-drawer { position: fixed; z-index: 23; inset: 0; margin: 0; pointer-events: none; }
  .shorts-create-drawer > .shorts-create-fab { pointer-events: auto; }
  .shorts-create-drawer[open] { pointer-events: auto; }
  .shorts-create-drawer[open] .short-video-composer { position: fixed; z-index: 25; right: 12px; bottom: calc(142px + env(safe-area-inset-bottom)); left: 12px; max-height: min(72dvh, 620px); overflow-y: auto; margin: 0; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
}

.short-video-tools .short-control-glyph {
  display: block;
  min-height: 22px;
  color: currentColor;
  font-size: 22px;
  font-weight: 700;
  line-height: 22px;
}
.short-video-tools .short-video-comments:hover,
.short-video-tools .short-video-comments:focus-visible { color: #fff; }
.short-video-tools .short-video-share,
.short-video-tools .short-video-sound { min-height: 48px; }

/* TikTok-like action rail: the icon is the primary control, the count stays readable below it. */
.short-video-tools button {
  width: 64px;
  min-height: 64px;
  gap: 3px;
  border-radius: 20px;
}
.short-video-tools .ui-icon {
  width: 31px;
  height: 31px;
  stroke-width: 2.2;
}
.short-video-tools .short-video-comments .ui-icon {
  width: 33px;
  height: 33px;
}
.short-video-tools .short-video-share .short-action-label {
  max-width: 54px;
  font-size: 9px;
}
@media (max-width: 800px) {
  .short-video-tools button {
    width: 62px;
    min-height: 62px;
    border-radius: 19px;
  }
  .short-video-tools .ui-icon {
    width: 30px;
    height: 30px;
  }
}

/* Clean TikTok-style rail: only the four actions remain, without square tiles. */
.short-video-tools .short-video-repost-people,
.short-video-tools .short-video-sound,
.short-video-tools .short-video-views,
.short-video-tools .short-video-delete {
  display: none !important;
}

.short-video-tools button {
  width: 50px !important;
  min-width: 50px;
  height: 62px;
  min-height: 62px !important;
  padding: 2px 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .9);
}

.short-video-tools button:hover,
.short-video-tools button:focus-visible {
  background: transparent !important;
  outline: none;
}

.short-video-tools .short-action-count {
  display: block !important;
  margin-top: 2px;
  color: currentColor;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .9);
}

.short-video-tools .short-action-label {
  display: none !important;
}

.short-video-tools button .ui-icon {
  width: 35px;
  height: 35px;
  filter: drop-shadow(0 2px 7px rgba(0, 0, 0, .8));
}

.short-video-tools button:hover {
  transform: scale(1.06);
}

.short-video-overlay .repost-credit {
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .9);
}

/* Direct clips route: share and create sheets stay lightweight and never
   replace the video feed with a full application rerender. */
.short-share-sheet,
.short-create-sheet {
  position: fixed;
  z-index: 60;
  right: 12px;
  bottom: calc(84px + env(safe-area-inset-bottom));
  left: 12px;
  width: min(430px, calc(100% - 24px));
  max-height: min(70dvh, 560px);
  margin: 0 auto;
  padding: 16px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 22px;
  color: #fff;
  background: rgba(17, 13, 27, .98);
  box-shadow: 0 20px 70px rgba(0, 0, 0, .58);
  backdrop-filter: blur(18px);
}
.short-share-head,
.short-create-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}
.short-share-head strong,
.short-share-head small,
.short-create-head strong,
.short-create-head small { display: block; }
.short-share-head small,
.short-create-head small { margin-top: 4px; color: rgba(255, 255, 255, .58); font-size: 12px; }
.short-share-close { display: grid; flex: 0 0 auto; place-items: center; width: 40px; height: 40px; border: 1px solid rgba(255, 255, 255, .18); border-radius: 50%; color: #fff; background: transparent; }
.short-share-close .ui-icon { width: 20px; height: 20px; }
.short-share-external { display: flex; width: 100%; min-height: 48px; align-items: center; justify-content: center; gap: 9px; margin: 14px 0 10px; border: 1px solid rgba(189, 162, 255, .5); border-radius: 14px; color: #fff; background: rgba(127, 86, 205, .28); font-weight: 700; }
.short-share-external .ui-icon { width: 21px; height: 21px; }
.short-share-list { display: grid; gap: 4px; }
.short-share-person { display: grid; grid-template-columns: 42px minmax(0, 1fr) 24px; gap: 10px; align-items: center; width: 100%; min-height: 58px; padding: 7px 6px; border: 0; border-radius: 13px; color: #fff; background: transparent; text-align: left; }
.short-share-person:hover,
.short-share-person:focus-visible { background: rgba(255, 255, 255, .09); outline: none; }
.short-share-person strong,
.short-share-person small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.short-share-person small { margin-top: 3px; color: rgba(255, 255, 255, .55); font-size: 11px; }
.short-share-person > .ui-icon { width: 19px; height: 19px; color: #cbb7ff; }
.short-share-avatar { display: grid; width: 42px; height: 42px; place-items: center; overflow: hidden; border-radius: 50%; color: #fff; background: #6f4ab7; font-size: 13px; font-weight: 800; }
.short-share-avatar img { width: 100%; height: 100%; object-fit: cover; }
.short-share-empty { padding: 20px 8px; color: rgba(255, 255, 255, .62); text-align: center; }
.short-create-form { display: grid; gap: 12px; padding-top: 14px; }
.short-create-upload { display: grid; min-height: 94px; place-items: center; gap: 6px; padding: 16px; border: 1px dashed rgba(189, 162, 255, .62); border-radius: 16px; color: #fff; background: rgba(255, 255, 255, .05); text-align: center; cursor: pointer; }
.short-create-upload .ui-icon { width: 28px; height: 28px; color: #cbb7ff; }
.short-create-upload input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.short-create-caption { display: grid; gap: 7px; color: rgba(255, 255, 255, .7); font-size: 12px; }
.short-create-caption input { width: 100%; min-height: 46px; padding: 0 13px; border: 1px solid rgba(255, 255, 255, .18); border-radius: 13px; color: #fff; background: rgba(255, 255, 255, .07); }
.short-create-form .primary-btn { min-height: 48px; }
@media (min-width: 801px) {
  .short-share-sheet,
  .short-create-sheet { right: 24px; bottom: 24px; left: auto; }
}

.short-comment-avatar {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  color: #fff;
  background: #6f4ab7;
  font-size: 11px;
  font-weight: 800;
}
.short-comment-avatar img { width: 100%; height: 100%; object-fit: cover; }
.short-comment-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 7px; }
.short-comment-action { min-height: 28px; padding: 3px 8px; border: 0; border-radius: 9px; color: rgba(255, 255, 255, .66); background: transparent; font-size: 11px; }
.short-comment-action:hover, .short-comment-action:focus-visible { color: #fff; background: rgba(255, 255, 255, .1); outline: none; }
.short-comment-action.liked { color: #ff7895; }
.short-comment-row.short-comment-reply { margin-left: 34px; }
.short-create-compose { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 10px; align-items: end; padding-top: 14px; }
.short-create-compose .short-create-upload { grid-column: 1 / -1; min-height: 82px; }
.short-create-compose .short-create-caption { grid-column: 1; min-width: 0; }
.short-create-publish { display: grid; width: 44px; height: 44px; place-items: center; padding: 0; border: 1px solid rgba(189, 162, 255, .55); border-radius: 13px; color: #fff; background: #7650c4; box-shadow: 0 8px 18px rgba(0, 0, 0, .25); }
.short-create-publish .ui-icon { width: 20px; height: 20px; }
.short-create-publish:hover, .short-create-publish:focus-visible { background: #8b63d7; outline: 2px solid rgba(189, 162, 255, .4); outline-offset: 2px; }
.short-create-publish:disabled { cursor: wait; opacity: .55; }

/* Clip controls: compact search in the top-right and nested options that stay
   closed until the three-dot menu is opened. */
.clips-direct-layout .topbar {
  gap: 10px;
}
.clips-topbar-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}
.short-clip-search {
  display: block;
  width: min(42vw, 230px);
}
.short-clip-search input {
  width: 100%;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: var(--panel-2);
  outline: none;
}
.short-clip-search input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--purple) 22%, transparent);
}
.short-clip-menu-parent {
  display: flex !important;
  align-items: center;
  justify-content: space-between !important;
  gap: 20px;
}
.short-clip-menu-parent span {
  color: var(--muted);
  font-size: 18px;
}
.short-clip-submenu {
  display: grid;
  gap: 2px;
  margin: 0 4px 5px 10px;
  padding-left: 7px;
  border-left: 1px solid var(--line);
}
.short-clip-submenu button {
  min-height: 36px;
  padding-block: 7px;
  color: var(--muted);
  font-size: 12px;
}
.short-clip-submenu button:hover,
.short-clip-submenu button:focus-visible {
  color: var(--text);
  background: var(--panel-2);
}
.short-search-empty {
  margin: 18px auto;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 520px) {
  .short-clip-search {
    width: min(45vw, 170px);
  }
  .short-clip-search input {
    min-height: 38px;
    padding-inline: 10px;
    font-size: 12px;
  }
  .clips-direct-layout .page-title {
    max-width: 64px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
