@layer controller {
  .left, header>div { flex: 73; }
  .flexfix { flex: 70px; }

  /* общий fullscreen photo modal */
  body.no-scroll{
    overflow: hidden;
    touch-action: none;
  }

  .photo-wrap .photo.fullsize{
    cursor: zoom-in;
  }

  #photo-modal{
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.02);
    z-index: 99000;
    overflow: hidden;
    opacity: 0;
    overscroll-behavior: contain;
    touch-action: none;
    transition:
      opacity .34s ease,
      background-color .34s ease,
      backdrop-filter .34s ease;
  }
  
  #photo-modal.photo-modal--visible{
    opacity: 1;
    background: rgba(0,0,0,.94);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }
  
  #photo-modal::after{
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
      radial-gradient(120% 90% at 50% 50%, transparent 48%, rgba(0,0,0,.22) 100%);
    opacity: 0;
    transition: opacity .42s ease;
  }

  #photo-modal::before{
    content: "";
    position: absolute;
    inset: 0;
    background:
      radial-gradient(1200px 700px at 50% 50%, rgba(255,255,255,.04), transparent 60%);
    pointer-events: none;
  }
  
  #photo-modal.photo-modal--open::after{
    opacity: 1;
  }

  #photo-modal-img{
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate3d(0,0,0) scale(1);
    transform-origin: center center;
    max-width: none;
    max-height: none;
    will-change: transform, opacity, filter;
    user-select: none;
    -webkit-user-drag: none;
    touch-action: none;
    cursor: zoom-in;
    opacity: 1;
    filter: none;
    border-radius: 10px;
    box-shadow:
      0 26px 90px rgba(0,0,0,.55),
      0 0 0 1px rgba(255,255,255,.08);
    backface-visibility: hidden;
  }
  
  #photo-modal,
  #photo-modal *{
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
  }

  #photo-modal-img{
    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    touch-action: none;
  }

  #photo-modal.photo-modal--zoomed #photo-modal-img{ cursor: grab; }
  #photo-modal.photo-modal--dragging #photo-modal-img{ cursor: grabbing; }
  
  #photo-modal.photo-modal--closing #photo-modal-img{
    transition:
      transform .30s cubic-bezier(.2,.9,.2,1),
      opacity .22s ease,
      filter .22s ease !important;
  }

  .photo-modal__close{
    position: absolute;
    top: calc(14px + env(safe-area-inset-top));
    right: calc(14px + env(safe-area-inset-right));
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.16);
    background: rgba(0,0,0,.55);
    color: #fff;
    font: 900 18px/1 Inter, system-ui, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(14px) saturate(130%);
    -webkit-backdrop-filter: blur(14px) saturate(130%);
    z-index: 2;
    opacity: 0;
    transform: translateY(-10px) scale(.94) rotate(-6deg);
    transition:
      opacity .24s ease,
      transform .34s cubic-bezier(.18,.88,.22,1),
      background-color .18s ease;
  }

  .photo-modal__hint{
    position: absolute;
    left: 50%;
    bottom: calc(12px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    white-space: nowrap;
    font: 700 11px/1 Inter, system-ui, sans-serif;
    color: rgba(255,255,255,.86);
    background: rgba(0,0,0,.45);
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 999px;
    padding: 7px 10px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 2;
    pointer-events: none;
  }
  
  #photo-modal.photo-modal--open .photo-modal__close{
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0);
  }
  
  .photo-modal__close:active{
    transform: scale(.94);
    background: rgba(255,255,255,.12);
  }

  .photo-modal__hint{
    position: absolute;
    left: 50%;
    bottom: calc(12px + env(safe-area-inset-bottom));
    transform: translateX(-50%) translateY(8px);
    white-space: nowrap;
    font: 700 11px/1 Inter, system-ui, sans-serif;
    color: rgba(255,255,255,.90);
    background: rgba(0,0,0,.48);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 999px;
    padding: 7px 10px;
    backdrop-filter: blur(12px) saturate(120%);
    -webkit-backdrop-filter: blur(12px) saturate(120%);
    z-index: 2;
    pointer-events: none;
    opacity: 0;
    transform-origin: center bottom;
    transition:
      opacity .28s ease,
      transform .32s cubic-bezier(.2,.9,.2,1);
  }

  #photo-modal.photo-modal--open .photo-modal__hint{
    opacity: .95;
    transform: translateX(-50%) translateY(0);
    animation: photoHintFloat 2.4s ease-in-out .35s 2;
  }

  #photo-modal.photo-modal--zoomed .photo-modal__hint{
    opacity: .0;
    transform: translateX(-50%) translateY(14px);
  }

  @keyframes photoHintFloat{
    0%,100%{ transform: translateX(-50%) translateY(0); }
    50%{ transform: translateX(-50%) translateY(-2px); }
  }

  @media (max-width: 800px){
    #photo-modal-img{
      border-radius: 0;
      box-shadow: 0 12px 46px rgba(0,0,0,.42);
    }

    .photo-modal__hint{
      font-size: 10px;
      padding: 6px 9px;
      bottom: calc(10px + env(safe-area-inset-bottom));
      max-width: calc(100vw - 20px);
      overflow: hidden;
      text-overflow: ellipsis;
    }
  }
  
  #mobile-tabbar #ai-open-mobile{
    transform: translateY(-2px);
    box-shadow:
      0 10px 28px rgba(0,0,0,.36),
      0 0 0 1px rgba(255,255,255,.10) inset;
  }

  #mobile-tabbar #ai-open-mobile:active{
    transform: translateY(-1px) scale(.97);
  }
  
}